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

mongodump dumps a collection with capped in metadata when it's not (anymore)

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.2.2
    • None
    • None
    • Linux 2.6.32-279.14.1.el6.x86_64 #1 SMP
    • Fully Compatible
    • ALL
    • Hide

      Simple instructions:

      # mongo
      MongoDB shell version: 2.2.2
      connecting to: test
      > db.createCollection('test', { capped: true, size: 100000 });
      { "ok" : 1 }
      > db.test.isCapped()
      true
       
      # mongodump --db test -c test
      connected to: 127.0.0.1
      Wed Jan 30 12:44:26 DATABASE: test	 to 	dump/test
      Wed Jan 30 12:44:26 	test.test to dump/test/test.bson
      Wed Jan 30 12:44:26 		 0 objects
      Wed Jan 30 12:44:26 	Metadata for test.test to dump/test/test.metadata.json
       
      # cat dump/test/test.metadata.json 
      { "options" : { "create" : "test", "capped" : true, "size" : 100000 }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }
       
      # mongo
      MongoDB shell version: 2.2.2
      connecting to: test
      > db.test.drop()
      true
      > db.createCollection('test')
      { "ok" : 1 }
      > db.test.isCapped()
      false
       
      # rm -rf dump
      # mongodump --db test -c test
      connected to: 127.0.0.1
      Wed Jan 30 12:45:33 DATABASE: test	 to 	dump/test
      Wed Jan 30 12:45:33 	test.test to dump/test/test.bson
      Wed Jan 30 12:45:33 		 0 objects
      Wed Jan 30 12:45:33 	Metadata for test.test to dump/test/test.metadata.json
       
      # cat dump/test/test.metadata.json 
      { "options" : { "create" : "test", "capped" : { "$undefined" : true }, "size" : { "$undefined" : true } }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }

      Show
      Simple instructions: # mongo MongoDB shell version: 2.2.2 connecting to: test > db.createCollection('test', { capped: true, size: 100000 }); { "ok" : 1 } > db.test.isCapped() true   # mongodump --db test -c test connected to: 127.0.0.1 Wed Jan 30 12:44:26 DATABASE: test to dump/test Wed Jan 30 12:44:26 test.test to dump/test/test.bson Wed Jan 30 12:44:26 0 objects Wed Jan 30 12:44:26 Metadata for test.test to dump/test/test.metadata.json   # cat dump/test/test.metadata.json { "options" : { "create" : "test", "capped" : true, "size" : 100000 }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }   # mongo MongoDB shell version: 2.2.2 connecting to: test > db.test.drop() true > db.createCollection('test') { "ok" : 1 } > db.test.isCapped() false   # rm -rf dump # mongodump --db test -c test connected to: 127.0.0.1 Wed Jan 30 12:45:33 DATABASE: test to dump/test Wed Jan 30 12:45:33 test.test to dump/test/test.bson Wed Jan 30 12:45:33 0 objects Wed Jan 30 12:45:33 Metadata for test.test to dump/test/test.metadata.json   # cat dump/test/test.metadata.json { "options" : { "create" : "test", "capped" : { "$undefined" : true }, "size" : { "$undefined" : true } }, "indexes" : [ { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.test", "name" : "_id_" } ] }

    Description

      Mongodump seems to dump a collection with capped metadata in collection.metadata.json. The collection was previously capped, but was dropped and recreated as uncapped. This will cause an error when mongorestoring the collection.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rosmo Taneli Leppä
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: