[DOCS-12044] Aggregation lookup example is not working on mongodb version: 4.0.2 Created: 10/Sep/18 Updated: 27/Oct/23 Resolved: 11/Sep/18 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | 4.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jorge Soares | Assignee: | Nicholas Larew |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | debian, docker, jessie | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Debian Jessie |
||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Days since reply: | 5 years, 22 weeks, 2 days ago | ||||||||||||||||
| Description |
| Comments |
| Comment by Nicholas Larew [ 11/Sep/18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jorge, I think the issue you're encountering stems from running an old version of the mongo shell. The shell is released as a component of the mongodb server distribution, and it mirrors the version number of the server. In general you should always use a shell with at least the same version as the server you are connecting to. The cursor behavior you're encountering was added in version 3.6, so the 2.4.10 shell cannot handle the command correctly. In your case, you should upgrade to shell version 4.0.2, which you'll find included in the bin directory of the current stable Community Server release.
I'm going to close this ticket as "Works as Designed". If you continue having issues after upgrading to the latest version of the mongo shell, feel free to comment on this ticket or file a new one. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jorge Soares [ 11/Sep/18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Nick, Mongo Shell Version - MongoDB shell version: 2.4.10 MongoDB server - > db.version() I got the mongodb image from: https://hub.docker.com/_/mongo/ I am running the docker container under vagrant, OS: vagrant@ircbot1:~$ lsb_release -a I had tried your suggestion before, with the cursor attribute set, but I get a parsing error as well. It's definitely a problem at my end. I reckon will create a pristine vagrant VM and run the steps again. Thanks for having a look.
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Larew [ 10/Sep/18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jorge, I'm not entirely sure what the root of the issue is, particularly since you didn't see any results from trying --norc. I'll make sure we investigate what's happening here as best as we can. Could you provide some information about your environment to help us? Specifically:
In the meantime, you should be able to circumvent this issue by specifying the cursor option in the aggregation options document (the second argument to the aggregate method), e.g.
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jorge Soares [ 10/Sep/18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Nick.
Thanks for your prompt reply. Do you mean:
I ran it. Changed nothing out of this example: And I still get:
Not sure if I'm doing something wrong. Very new to mongodb... Regards, Jorge | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nicholas Larew [ 10/Sep/18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Jorge, Thanks for filing a docs ticket! The examples listed on the page match the expected behavior of the commands. The error you posted should only be output when the cursor option is not set in the aggregation command (as of version 3.6), i.e. db.runCommand({ aggregate: "collection", pipeline: [ ... ], The aggregation shell helper, i.e. db.collection.aggregate([ ... ]), automatically returns a cursor.
|