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

sparse indexes break $exists query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.0.2
    • None
    • Index Maintenance, Querying
    • None
    • ALL

    Description

      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 }

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: