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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 3.6.7, 4.0.0
    • Tools
    • None
    • Windows
    • ALL

    Description

      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 }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: