[SERVER-13788] $exists in find() gives error Created: 30/Apr/14 Updated: 10/Dec/14 Resolved: 30/Apr/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.6.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Xiong Sheng [X] | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
The following query can be executed successfully:
But, swith the places of the criteria:
system gives the following error:
|
| Comments |
| Comment by Alvin Richards (Inactive) [ 30/Apr/14 ] |
|
The reference for the find command can be found here http://docs.mongodb.org/manual/reference/method/db.collection.find/ Essentially you have added a projection criteria as the second parameter (like the items in the "select" statement in SQL).
The second is not a valid projection operator, see here for details of what you can do http://docs.mongodb.org/manual/reference/operator/projection/. You may be trying to do a logical $and or $or between the $exists and null comparison, see here for details http://docs.mongodb.org/manual/reference/operator/query/#logical |