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

if a field has a regular filter and $ors, index breaks in

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9.1
    • Component/s: Indexing
    • Labels:
      None
    • Operating System:
      ALL

      Description

      db.testcase.drop();
      db.testcase.insert( { a : [

      { x : 1 }

      ,

      { x : 2 }

      ,

      { x : 3 }

      ,

      { x : 4 }

      ] } )

      function test(){
      print( db.testcase.find(
      {
      a :

      { x : 1 }

      ,
      "$or" : [ { a :

      { x : 2 }

      } , { a :

      { x : 3 }

      } ]
      }
      ).count() )
      }

      // The first find will return a result since there isn't an index
      test();

      // Now create an index

      db.testcase.ensureIndex(

      {"a":1}

      )

      // The same query will not return data now
      test();

      // Drop the indexes

      db.testcase.dropIndexes()

      // And it will return data again
      test()

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: