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

Ambiguous field name error should be ignored during initial sync

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.2, v4.0, v3.6
    • Sprint:
      Repl 2020-01-27, Repl 2020-02-10
    • Linked BF Score:
      6

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: