[SERVER-1190] $exists fails on indexed field Created: 03/Jun/10  Updated: 03/Jun/10  Resolved: 03/Jun/10

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

Type: Bug Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

> db.people.save(

{ fname: "BOB", lname: "SMITH" }

)
> db.people.find(

{ lname: "SMITH" }

)

{ "_id" : ObjectId("4c06e2eb4138a24d33ee0fdc"), "fname" : "BOB", "lname" : "SMITH" }

> db.people.save(

{ fname: "BOB", lname: "SMITH", mname: "ROBERT", suffix: "JR" }

)
> db.people.ensureIndex(

{"lname":1,"fname":1,"mname":1,"suffix":1}

);
> db.people.find({ lname: "SMITH", mname:

{ $exists: false }

})

-Nothing Returned-

Also, using null for the value retrieves the doc even thought that is incorrect (since the index stores a null for that index value).

> db.people.find(

{ lname: "SMITH", mname: null }

)

{ "_id" : ObjectId("4c06e2eb4138a24d33ee0fdc"), "fname" : "BOB", "lname" : "SMITH" }

 Comments   
Comment by Eliot Horowitz (Inactive) [ 03/Jun/10 ]

See SERVER-393

Generated at Thu Feb 08 02:56:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.