$exists fails on indexed field

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.5.2
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      > 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" }

            Assignee:
            Eliot Horowitz (Inactive)
            Reporter:
            Scott Hernandez (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: