--archive flag of mongorestore requires "--archive=filename", does not work with "--archive filename"

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator
    • 24

      Problem Statement/Rationale

      When running mongorestore, use of the -archive flag requires the form -archive=filename.  If the archive is passed in the form --archive filename, restore hangs.

      Steps to Reproduce

      • Start a local mongod instance
      • Restore the sample_supplies database to it using the {}archive=filename{-} form of the flag (note the form of the -nsInclude flag in this example):

       

      $ mongorestore "mongodb://localhost:27017" --drop --nsInclude "*" --archive=sample_supplies.archive
      2026-05-07T12:09:44.336-0400    WARNING: This archive came from MongoDB `6.0.0-rc8`, but you are restoring to `7.0.32`. Cross-version dump & restore is unsupported. The restored data may be corrupted.
      2026-05-07T12:09:44.337-0400    preparing collections to restore from
      2026-05-07T12:09:44.340-0400    reading metadata for `sample_supplies.sales` from "archive `sample_supplies.archive`"
      2026-05-07T12:09:44.366-0400    restoring `sample_supplies.sales` from "archive `sample_supplies.archive`"
      2026-05-07T12:09:44.459-0400    finished restoring `sample_supplies.sales` (5000 documents, 0 failures)
      2026-05-07T12:09:44.459-0400    no indexes to restore for collection `sample_supplies.sales`
      2026-05-07T12:09:44.459-0400    5000 document(s) restored successfully. 0 document(s) failed to restore. 

       

      • Drop the restored database:

       

      $ mongosh "mongodb://localhost:27017"
      Current Mongosh Log ID:    69fcbae424869025f7855016
      Connecting to:        mongodb://localhost:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.8.2
      Using MongoDB:        7.0.32
      Using Mongosh:        2.8.2
      [...]
      ------Enterprise test> show dbs
      admin             40.00 KiB
      config           108.00 KiB
      local             72.00 KiB
      sample_supplies  968.00 KiB
      Enterprise test> use sample_supplies
      switched to db sample_supplies
      Enterprise sample_supplies> db.dropDatabase()
      { ok: 1, dropped: 'sample_supplies' }
      Enterprise sample_supplies> exit 

       

       

      • Restore the sample_supplies database again, but this time using a space with the --archive flag:

       

      $ mongorestore "mongodb://localhost:27017" --drop --nsInclude "*" --archive sample_supplies.archive
      [mongorestore hangs with no output] 

       

      Expected Results

      Restore works with either form of the --archive flag.

      Actual Results

      When using the form --archive archive_file, the restore does nothing.

      Additional Notes

      mongod log entries from the second mongorestore connection:

       

      {"t":{"$date":"2026-05-07T12:22:29.121-04:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:63604","isLoadBalanced":false,"uuid":{"uuid":{"$uuid":"deeb9206-206e-423d-8322-1d6004b7dc31"}},"connectionId":25,"connectionCount":1}}
      {"t":{"$date":"2026-05-07T12:22:29.122-04:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn25","msg":"client metadata","attr":{"remote":"127.0.0.1:63604","client":"conn25","negotiatedCompressors":[],"doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.122-04:00"},"s":"I",  "c":"ACCESS",   "id":10483900,"ctx":"conn25","msg":"Connection not authenticating","attr":{"client":"127.0.0.1:63604","doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:63605","isLoadBalanced":false,"uuid":{"uuid":{"$uuid":"96a7a588-e473-4e73-82b1-0dd3114168a4"}},"connectionId":26,"connectionCount":2}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:63606","isLoadBalanced":false,"uuid":{"uuid":{"$uuid":"43e44807-1a58-4e7e-944e-df9e65f39ece"}},"connectionId":27,"connectionCount":3}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn26","msg":"client metadata","attr":{"remote":"127.0.0.1:63605","client":"conn26","negotiatedCompressors":[],"doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"ACCESS",   "id":10483900,"ctx":"conn26","msg":"Connection not authenticating","attr":{"client":"127.0.0.1:63605","doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn27","msg":"client metadata","attr":{"remote":"127.0.0.1:63606","client":"conn27","negotiatedCompressors":[],"doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"ACCESS",   "id":10483900,"ctx":"conn27","msg":"Connection not authenticating","attr":{"client":"127.0.0.1:63606","doc":{"application":{"name":"mongorestore"},"driver":{"name":"mongo-go-driver","version":"2.5.0"},"os":{"type":"darwin","architecture":"arm64"},"platform":"go1.25.7"}}}
      {"t":{"$date":"2026-05-07T12:22:29.123-04:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn26","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":0}}
      {"t":{"$date":"2026-05-07T12:22:45.051-04:00"},"s":"I",  "c":"WTCHKPT",  "id":22430,   "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":{"ts_sec":1778170965,"ts_usec":51350,"thread":"42684:0x17097b000","session_name":"WT_SESSION.checkpoint","category":"WT_VERB_CHECKPOINT_PROGRESS","category_id":6,"verbose_level":"DEBUG_1","verbose_level_id":1,"msg":"saving checkpoint snapshot min: 145, snapshot max: 145 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 883"}}} 

       

       

      • If I wait long enough, I've seen mongorestore in the scenario fail with an error about the archive being invalid.  I'm not sure if that behavior is consistent though.

            Assignee:
            Unassigned
            Reporter:
            Joe Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: