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

mongo shell doesn't support inserting documents with duplicate field names

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.6.7, 4.0.0
    • Component/s: Tools
    • None
    • Environment:
      Windows
    • ALL

      Example shell output:

      > db.dup.insert({_id:1, a:1, a:2})
      WriteResult({ "nInserted" : 1 })
      > db.dup.find()

      { "_id" : 1, "a" : 2 }

      InsertMany has the same problem:

      > db.dup.insertMany([\{_id:1, a:1, a:2},\{_id:2,a:1,a:2}])

      { "acknowledged" : true, "insertedIds" : [ 1, 2 ] }

      > db.dup.find()

      { "_id" : 1, "a" : 2 } { "_id" : 2, "a" : 2 }

            Assignee:
            nick.brewer Nick Brewer
            Reporter:
            admilazz Adam Milazzo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: