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

db.createCollection creates undefined fields which cause mongorestore to fail

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.3.1
    • Fix Version/s: 2.2.5, 2.4.4, 2.5.0
    • Component/s: Admin, Tools
    • Labels:
    • Environment:
      Ubuntu 12.04 64bit using 10gen repositories
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      > use test
      > db.dropDatabase()
      > db.createCollection("coll")

      $ mongodump

      > db.coll.drop()

      $ mongorestore

      Show
      > use test > db.dropDatabase() > db.createCollection("coll") $ mongodump > db.coll.drop() $ mongorestore
    • Case:

      Description

      The db.createCollection() helper has some optional collection options which get set to undefined if they are not provided. This causes mongodump to output undefined elements which can cause mongorestore to fail.

      The documents have the form:

      { "options" : { "create" : "coll", "capped" :

      { "$undefined" : true }

      , "size" :

      { "$undefined" : true }

      }, "indexes" : [ { "v" : 1, "key" :

      { "_id" : 1 }

      , "ns" : "test.coll", "name" : "id" } ] }

        Attachments

        1. after_fix.txt
          3 kB
        2. before_fix.txt
          3 kB
        3. create_restore_test
          1 kB

          Issue Links

            Activity

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                22 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: