Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12351

Stitch Basic Blog tutorial uses incorrect function

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Stitch
    • Labels:
      None

      Description

      We need to update the blog html file to point to the latest JS SDK 

      blog html

      https://github.com/mongodb/stitch-examples/blob/master/basic-blog/blog.html

      Latest JS SDK

      https://s3.amazonaws.com/stitch-sdks/js/bundles/4/stitch.js

      Original Description

      https://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
      at displayComments (blog.html:30)

       

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            lauren.schaefer@mongodb.com Lauren Schaefer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              5 years, 14 weeks, 6 days ago