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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.1
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • Labels:
      None
    • ALL

      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()

            Assignee:
            aaron Aaron Staple
            Reporter:
            eliot Eliot Horowitz (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: