Can't restore `mongodump` archivegz file with `mongorestore`



  • I generated a MongoDB dump file with the archivegz format. When I try to restore it with the mongorestore command, it won't restore.

    The command for restore

    mongorestore --gzip --archive="./mongo_device.bing.com_20220209-000000.archivegz" --db=Test --verbose
    

    The result

    2022-02-10T11:57:02.955+0330    using write concern: &{majority false 0}
    2022-02-10T11:57:03.587+0330    will listen for SIGTERM, SIGINT, and SIGKILL
    2022-02-10T11:57:03.588+0330    connected to node type: standalone
    2022-02-10T11:57:03.588+0330    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
    2022-02-10T11:57:03.740+0330    archive prelude Logger.logs
    2022-02-10T11:57:03.740+0330    archive prelude Logger.DeviceChannelData
    2022-02-10T11:57:03.740+0330    archive format version "0.1"
    2022-02-10T11:57:03.740+0330    archive server version "4.4.3"
    2022-02-10T11:57:03.740+0330    archive tool version "v3.15.0_alpha20210804-4411-g6ef8a4d4d7"
    2022-02-10T11:57:03.741+0330    preparing collections to restore from
    2022-02-10T11:57:03.741+0330    skipping restoring Logger.logs, it is not included
    2022-02-10T11:57:03.741+0330    skipping restoring Logger.logs metadata, it is not included
    2022-02-10T11:57:03.742+0330    skipping restoring Logger.DeviceChannelData, it is not included
    2022-02-10T11:57:03.742+0330    skipping restoring Logger.DeviceChannelData metadata, it is not included
    2022-02-10T11:57:04.208+0330    demux finishing (err:)
    2022-02-10T11:57:04.208+0330    received  from namespaceChan
    2022-02-10T11:57:04.208+0330    restoring up to 4 collections in parallel
    2022-02-10T11:57:04.208+0330    building indexes up to 4 collections in parallel
    2022-02-10T11:57:04.208+0330    0 document(s) restored successfully. 0 document(s) failed to restore.
    2022-02-09T13:50:42.321+0330    preparing collections to restore from
    2022-02-09T13:50:42.755+0330    0 document(s) restored successfully. 0 document(s) failed to restore.
    


  • My mistake was in incorrectly setting the --db flag. When the flag is removed, the mongorestore restores the data. Use the command as described below.

    mongorestore --gzip --archive="./mongo_device.bing.com_20220209-000000.archivegz"
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2