Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-112

mongorestore doesn't respect "--noIndexRestore" flag if no collection metadata files are present

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: Legacy C++ Implementation
    • Component/s: mongorestore
    • Labels:
      None

      mongodump --repair and old versions of mongodump do not produce collection metadata json files, so system.indexes.bson is used to restore the indexes. In this case mongorestore 2.4 completely ignores the --noIndexRestore flag when it's provided:

      AD-MAC10G:ok alexander$ mongodump
      connected to: 127.0.0.1
      Mon Dec  2 16:44:54.994 all dbs
      Mon Dec  2 16:44:54.994 DATABASE: test	 to 	dump/test
      Mon Dec  2 16:44:54.994 	test.system.indexes to dump/test/system.indexes.bson
      Mon Dec  2 16:44:54.995 		 4 objects
      Mon Dec  2 16:44:54.995 	test.test to dump/test/test.bson
      Mon Dec  2 16:44:54.995 		 2 objects
      Mon Dec  2 16:44:54.995 	Metadata for test.test to dump/test/test.metadata.json
      AD-MAC10G:ok alexander$ rm dump/test/test.metadata.json
      AD-MAC10G:ok alexander$ mongorestore --noIndexRestore dump/
      connected to: 127.0.0.1
      Mon Dec  2 16:45:06.789 dump/test/test.bson
      Mon Dec  2 16:45:06.789 	going into namespace [test.test]
      Mon Dec  2 16:45:06.789 dump/test/test.metadata.json not found. Skipping.
      Mon Dec  2 16:45:06.789 warning: Restoring to test.test without dropping. Restored data will be inserted without raising errors; check your server log
      2 objects found
      Mon Dec  2 16:45:06.790 dump/test/system.indexes.bson
      Mon Dec  2 16:45:06.790 	going into namespace [test.system.indexes]
      Mon Dec  2 16:45:06.790 warning: Restoring to test.system.indexes without dropping. Restored data will be inserted without raising errors; check your server log
      Mon Dec  2 16:45:06.790 	Creating index: { key: { _id: 1 }, ns: "test.test", name: "_id_" }
      Mon Dec  2 16:45:06.790 	Creating index: { key: { x: 1.0 }, ns: "test.test", name: "x_1" }
      Mon Dec  2 16:45:06.790 	Creating index: { key: { y: 1.0 }, ns: "test.test", name: "y_1" }
      Mon Dec  2 16:45:06.790 	Creating index: { key: { z: 1.0 }, ns: "test.test", name: "z_1" }
      4 objects found
      

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            alex.komyagin@mongodb.com Alexander Komyagin (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: