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

db.createCollection creates undefined fields which cause mongorestore to fail

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.2.5, 2.4.4, 2.5.0
    • 2.2.0, 2.3.1
    • Admin, Tools
    • Ubuntu 12.04 64bit using 10gen repositories
    • ALL
    • 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

    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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: