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

mongorestore does not restore data in new database when --archive is used

    XMLWordPrintable

    Details

    • Case:

      Description

      When dumping a database using the --archive option, mongorestore cannot restore the archive under a new database name and does not report any errors. See below for several examples where is dump a games database and try to restore it in video_games database.

      Dumping in stdout

      Davensons-MacBook-Pro-2:bin dlombard$ ./mongodump --archive --gzip --db games --port 27018 | ./mongorestore --archive --gzip --db video_games --port 27018
      2016-02-17T12:34:31.121-0500	writing games.consoles to archive on stdout
      2016-02-17T12:34:31.121-0500	done dumping games.consoles (8 documents)
      2016-02-17T12:34:31.170-0500	setting number of parallel collections to number of parallel collections in archive (8)
      2016-02-17T12:34:31.198-0500	creating intents for archive
      2016-02-17T12:34:31.249-0500	done
      Davensons-MacBook-Pro-2:bin dlombard$ ./mongo --port 27018
      MongoDB shell version: 3.2.1
      connecting to: 127.0.0.1:27018/test
      Server has startup warnings: 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
      MongoDB Enterprise > show dbs
      games  0.000GB
      local  0.000GB
      MongoDB Enterprise > 

      Dumping in stdout without --gzip

      Using archive file without gzip
      Davensons-MacBook-Pro-2:bin dlombard$ ./mongodump --archive --db games --port 27018 | ./mongorestore --archive --db video_games --port 27018
      2016-02-17T12:43:40.012-0500	writing games.consoles to archive on stdout
      2016-02-17T12:43:40.012-0500	done dumping games.consoles (8 documents)
      2016-02-17T12:43:40.058-0500	setting number of parallel collections to number of parallel collections in archive (8)
      2016-02-17T12:43:40.088-0500	creating intents for archive
      2016-02-17T12:43:40.137-0500	done
      Davensons-MacBook-Pro-2:bin dlombard$ ./mongo --port 27018
      MongoDB shell version: 3.2.1
      connecting to: 127.0.0.1:27018/test
      Server has startup warnings: 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
      MongoDB Enterprise > show dbs
      games  0.000GB
      local  0.000GB

      Dumping to a file and restoring from file

      Davensons-MacBook-Pro-2:bin dlombard$ ./mongodump --archive=../../games_archive.gz --gzip --db games --port 27018
      2016-02-17T12:46:01.171-0500	writing games.consoles to archive '../../games_archive.gz'
      2016-02-17T12:46:01.172-0500	done dumping games.consoles (8 documents)
      Davensons-MacBook-Pro-2:bin dlombard$ ./mongorestore --archive=../../games_archive.gz --gzip --db videogames --port 27018
      2016-02-17T12:46:08.696-0500	setting number of parallel collections to number of parallel collections in archive (8)
      2016-02-17T12:46:08.724-0500	creating intents for archive
      2016-02-17T12:46:08.775-0500	done
      Davensons-MacBook-Pro-2:bin dlombard$ ./mongo --port 27018
      MongoDB shell version: 3.2.1
      connecting to: 127.0.0.1:27018/test
      Server has startup warnings: 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] 
      2016-02-17T12:31:14.767-0500 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
      MongoDB Enterprise > show dbs
      games  0.000GB
      local  0.000GB
      MongoDB Enterprise > 

      Any clue what is causing this?

      Thanks,

      Davenson Lombard

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lucas.morales Lucas Morales
              Reporter:
              davenson.lombard Davenson Lombard (Inactive)
              Votes:
              11 Vote for this issue
              Watchers:
              22 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: