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

Parallel arrays in distinct sub-documents no longer cause an indexing error

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.2
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • Labels:
    • ALL
    • Hide
      var myDB = db.getSiblingDB('btree');
      myDB.dropDatabase();
      
      myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
      myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
      
      Show
      var myDB = db.getSiblingDB('btree'); myDB.dropDatabase(); myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1}); myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});

      This bug appears to be a regression from SERVER-8192. In 2.6.1, documents that contain parallel arrays in distinct sub-documents are not allowed to be inserted when a corresponding index is present:

      2.6.1:

      > var myDB = db.getSiblingDB('btree');
      > myDB.dropDatabase();
      { "dropped" : "btree", "ok" : 1 }
      
      > myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 10088,
      		"errmsg" : "insertDocument :: caused by :: 10088 cannot index parallel arrays [a] [a]"
      	}
      })
      

      2.6.2-pre w/ SERVER-8192 patch:

      > var myDB = db.getSiblingDB('btree');
      > myDB.dropDatabase();
      { "dropped" : "btree", "ok" : 1 }
      
      > myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
      WriteResult({ "nInserted" : 1 })
      

      master:

      > var myDB = db.getSiblingDB('btree');
      > myDB.dropDatabase();
      { "dropped" : "btree", "ok" : 1 }
      
      > myDB.foo.ensureIndex({'a.a': 1, 'b.a': 1});
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > myDB.foo.insert({a: {a: [1]}, b: {a: [1]}});
      WriteResult({ "nInserted" : 1 })
      

      Version: 9c3edc610c7f52a3d502fbc50e0acc55b5efa645

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: