mongorestore seems to add a space to the coll name

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator

      Problem Statement/Rationale

      With mongorestore an extra space is added to the target collection name.

      Steps to Reproduce

       

      LU60:~$ mongodump "mongodb+srv://<user>:<pwd>@<uri>.mongodb.net/" --archive="testDB.archive" --db=testDB
      2026-02-26T11:08:18.590+0100    writing testDB.testColl to archive 'testDB.archive'
      2026-02-26T11:08:18.621+0100    done dumping testDB.testColl (1 document)
      LU60:~$ mongorestore "mongodb+srv://<user>:<pwd>@<uri>.mongodb.net/" --archive="testDB.archive" --nsFrom=testDB\* --nsTo=testDBRestore\* 
      2026-02-26T11:08:25.349+0100    preparing collections to restore from
      2026-02-26T11:08:25.403+0100    reading metadata for testDBRestore.testColl  from archive 'testDB.archive'
      2026-02-26T11:08:25.422+0100    restoring to existing collection testDBRestore.testColl  without dropping
      2026-02-26T11:08:25.422+0100    restoring testDBRestore.testColl  from archive 'testDB.archive'
      2026-02-26T11:08:25.445+0100    finished restoring testDBRestore.testColl  (1 document, 0 failures)
      2026-02-26T11:08:25.448+0100    no indexes to restore for collection testDBRestore.testColl 
      2026-02-26T11:08:25.448+0100    1 document(s) restored successfully. 0 document(s) failed to restore.
      
      

       

      LU60:~$ mongorestore --version
      mongorestore version: 100.10.0
      git version: 6d4f001be3fcf673de04d20176e90ee02ef233a9
      Go version: go1.21.12
         os: linux
         arch: amd64
         compiler: gc
      LU60:~$
      
      cat /etc/os-release 
      PRETTY_NAME="Ubuntu 24.04.4 LTS"
      NAME="Ubuntu"
      VERSION_ID="24.04"
      VERSION="24.04.4 LTS (Noble Numbat)"
      VERSION_CODENAME=noble
      ID=ubuntu
      ID_LIKE=debian
      HOME_URL="https://www.ubuntu.com/"
      SUPPORT_URL="https://help.ubuntu.com/"
      BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
      PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
      UBUNTU_CODENAME=noble
      LOGO=ubuntu-logo

      The source does NOT have tailing spaces, the target has. I added a "X" at the last postion to visualize in the screenshot

      Expected Results

      the collection names are identical source to target when we dump/restore on db level

      Actual Results

      The target collection names (all) got a tailing extra space " " added to the name 

       

        1. image-2026-02-26-12-06-57-076.png
          11 kB
          Michael Höller
        2. testDB.archive
          0.9 kB
          Michael Höller

            Assignee:
            Unassigned
            Reporter:
            Michael Höller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: