Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4646

$and operator does not work

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.2
    • Component/s: Querying
    • Labels:
    • Environment:
      2.0.2 installed via Homebrew on Mac OS X 10.6.8
    • OS X

      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

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            pjb3 Paul Barry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: