[DOCS-12351] Stitch Basic Blog tutorial uses incorrect function Created: 11/Jan/19 Updated: 29/Oct/23 Resolved: 11/Jan/19 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | Stitch |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Lauren Schaefer (Inactive) | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: | |
| Days since reply: | 5 years, 4 weeks, 5 days ago |
| Description |
DescriptionWe need to update the blog html file to point to the latest JS SDK blog htmlhttps://github.com/mongodb/stitch-examples/blob/master/basic-blog/blog.html Latest JS SDKhttps://s3.amazonaws.com/stitch-sdks/js/bundles/4/stitch.js Original Descriptionhttps://docs.mongodb.com/stitch/tutorials/build-blog/ Step 3 currently includes to toArray() function. When I open the blog in Chrome I get the following error in my console: TypeError: db.collection(...).find(...).toArray is not a function
When I change toArray to asArray, the code works as expected.
The full example at https://github.com/mongodb/stitch-examples/blob/master/basic-blog/blog.html uses asArray.
According to aydrian.howard: Use `asArray` for the SDK and `toArray` for Stitch functions |
| Comments |
| Comment by Caleb Thompson [ 11/Jan/19 ] |
|
Fixed. Changed version number in the tutorial example to point to latest. |
| Comment by Lauren Schaefer (Inactive) [ 11/Jan/19 ] |
|
After talking with Doug Kaminsky, toArray now works in latest version. Changing the stitch sdk to 4.1.2 fixes the error. |