[SERVER-4646] $and operator does not work Created: 07/Jan/12  Updated: 30/Mar/12  Resolved: 07/Jan/12

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

Type: Bug Priority: Major - P3
Reporter: Paul Barry Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

2.0.2 installed via Homebrew on Mac OS X 10.6.8


Operating System: OS X
Participants:

 Description   

I expect the two findOne queries here to return the same result. This seems like a bug:

$ mongo
MongoDB shell version: 2.0.2
connecting to: test
> db.test.drop()
true
> db.test.insert(

{ x: 1, y: 2 }

)
> db.test.findOne(

{ x: 1, y: 2 }

)

{ "_id" : ObjectId("4f0885cd61d25fd4a5813ae2"), "x" : 1, "y" : 2 }

> db.test.findOne({ $and: [

{ x: 1 }

,

{ y: 2 }

] })
null



 Comments   
Comment by Paul Barry [ 07/Jan/12 ]

ah, the problem, which I figured out when I ran db.serverStatus() is that I was using the 2.0.2 client to connect to a 1.8.2. I had upgraded using homebrew but hadn't copied the new plist into place. Once I fixed that, the problem went away.

Thanks!

Comment by Scott Hernandez (Inactive) [ 07/Jan/12 ]

Please run this again with the output of db.serverStatus(), thanks.

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