[DOCS-2073] Incorrect aggregate() example result document Created: 10/Oct/13  Updated: 11/Jan/17  Resolved: 06/Nov/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Improvement Priority: Major - P3
Reporter: Hannes Magnusson Assignee: Kay Kim (Inactive)
Resolution: Duplicate Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
Participants:
Days since reply: 10 years, 18 weeks, 6 days ago

 Description   

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" ] }
>



 Comments   
Comment by Hannes Magnusson [ 10/Oct/13 ]

Well.. The entire page is outdated by the fact it returns a cursor now, not a result document.

It should probably be rewritten.

Generated at Thu Feb 08 07:42:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.