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

sparse indexes break $exists query

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.2
    • Component/s: Index Maintenance, Querying
    • None
    • ALL

      Adding a sparse index breaks $exists queries on that field.

      Sample console session:

      use bug
      // switched to db bug
      db.bug.insert({a: 1})
      db.bug.ensureIndex({b: 1}, {sparse: true})
      db.bug.find({b: {$exists: false}})
      // no result!
      db.bug.find({b: {$exists: false}}).hint({$natural: 1})
      // { "_id" : ObjectId("4f0c337f3715b68266d07790"), "a" : 1 }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            colinhowe Colin Howe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: