[SERVER-20241] "Query" as a property name is allowed, however querying on it is not possible Created: 01/Sep/15  Updated: 01/Sep/15  Resolved: 01/Sep/15

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Dave Workman Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-9812 User query is interpreted incorrectly... Closed
Operating System: ALL
Participants:

 Description   

If you have a document with the property name "query" in it, queries with $ne will not work.
Example:

db.coll.insert({ query: 'foo' })'
db.coll.findOne({ query: { $ne: 'bar' } });

Exact equality searches work:

db.coll.findOne({ query: 'foo' });



 Comments   
Comment by David Storch [ 01/Sep/15 ]

Resolving as a duplicate of SERVER-9812. As noted in SERVER-9812, this problem will be fixed with the introduction of the find command in SERVER-15176.

Comment by Bernie Hackett [ 01/Sep/15 ]

You may be able to do this instead:

db.coll.findOne({ $query: { query: { $ne: 'bar' } } });

Comment by Bernie Hackett [ 01/Sep/15 ]

No problem. I've moved this to the SERVER project.

Comment by Dave Workman [ 01/Sep/15 ]

Sorry, this is obviously not supposed to be in C Driver (should be core I believe). I don't seem to have edit permissions (or I can't figure out how to).

Generated at Thu Feb 08 03:53:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.