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

Ambiguous field name error should be ignored during initial sync

    • Fully Compatible
    • ALL
    • v4.2, v4.0, v3.6
    • Repl 2020-01-27, Repl 2020-02-10
    • 6

      The following error can happen when inserting a document like

      {_id: 0, a: [{0: 1}]}
      

      into a collection with an index on {"a.0": 1}:

      > db.foo.ensureIndex({"a.0": 1})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 2,
      	"numIndexesAfter" : 3,
      	"ok" : 1
      }
      > db.foo.insert({a: [{0: 1}]})
      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 16746,
      		"errmsg" : "Ambiguous field name found in array (do not use numeric field names in embedded elements in an array), field: '0' for array: { 0: { 0: 1.0 } }"
      	}
      })
      

      When finishing initial sync and applying oplog entries that happened during the sync, this error should be ignored. Like a unique index constraint violation, this should eventually be resolved during oplog application, either by a another operation deleting the document, or by another oplog entry dropping the index.

            Assignee:
            ryan.timmons@mongodb.com Ryan Timmons
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: