[SERVER-20129] $oid does not work with $ne Created: 26/Aug/15  Updated: 27/Aug/15  Resolved: 27/Aug/15

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

Type: Bug Priority: Major - P3
Reporter: Boris Petrov Assignee: Max Hirschhorn
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-6813 Shell support for Extended JSON Closed
Operating System: ALL
Sprint: QuInt 8 08/28/15
Participants:

 Description   

These two queries return a different result (executed in the mongo shell):

> db.objects.find({ "_id" : { "$ne" : ObjectId("55dda2e17da396655548870b") } }).count()
139
> db.objects.find({ "_id" : { "$ne" : { "$oid" : "55dda2e17da396655548870b" } } }).count()
140

The first one is correct and the second - wrong - it also returns the object with that ID. Am I missing something or is this a bug?



 Comments   
Comment by Max Hirschhorn [ 27/Aug/15 ]

The server does not treat the object {"$oid": "55dda2e17da396655548870b"} as an ObjectId, but as a query on a "$oid" field. Of course we reject documents during insert that start with $, so this will not match anything.

Closing this as a duplicate of SERVER-6813, which tracks having the mongo shell support the extended JSON syntax.

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