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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: Legacy C++ Implementation
    • Fix Version/s: None
    • Component/s: mongorestore
    • Labels:
      None

      Description

      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
      

        Attachments

          Activity

            People

            Assignee:
            backlog-server-platform Backlog - Platform Team
            Reporter:
            alex.komyagin Alexander Komyagin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: