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

Incorrect aggregate() example result document

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      http://docs.mongodb.org/manual/reference/method/db.collection.aggregate/

      The example output includes the keys "ok" and "result".
      This no longer holds true as of 2.5.3 as aggregate() now returns a cursor by default:

      > db.articles.aggregate(
      ...   { $project : {
      ...                  author : 1,
      ...                  tags : 1,
      ...                }
      ...   },
      ...   { $unwind : "$tags" },
      ...   { $group : {
      ...                _id : { tags : "$tags" },
      ...                authors : { $addToSet : "$author" }
      ...              }
      ...   }
      ... )
      { "_id" : { "tags" : "sport" }, "authors" : [  "bob" ] }
      { "_id" : { "tags" : "good" }, "authors" : [  "bob" ] }
      { "_id" : { "tags" : "fun" }, "authors" : [  "bob" ] }
      >
      

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              10 years, 31 weeks, 5 days ago