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

nsInclude does not work with percent encoded namespaces

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 100.1.0
    • Affects Version/s: None
    • Component/s: mongorestore

      repro: (thank you kay.kim)

      1. I dump out collections where the mongodump has to encode the filenames

      ~/mongo $ ls dump/test
      %CE%B7%CE%BC%CE%B5%CF%81%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF.bson		caf%C3%A9s.bson
      %CE%B7%CE%BC%CE%B5%CF%81%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF.metadata.json	caf%C3%A9s.metadata.json
      

      Then, I try to mongorestore --nsInclude these collections

      # First attempt using the unencoded names
      ~/mongo $ ./mongodb-4.2.0-rc2/bin/mongorestore -u kayadmin -p abc123 --authenticationDatabase=admin --nsInclude test.cafés dump/
      2019-07-08T14:00:39.908-0400	preparing collections to restore from
      2019-07-08T14:00:39.908-0400	0 document(s) restored successfully. 0 document(s) failed to restore.
      # Second attempt using the encoded names -- which we probably don't want people to use, but just for illustrative purposes 
      ~/mongo $ ./mongodb-4.2.0-rc2/bin/mongorestore -u kayadmin -p abc123 --authenticationDatabase=admin --nsInclude test.caf%C3%A9s dump/
      2019-07-08T14:03:06.831-0400	preparing collections to restore from
      2019-07-08T14:03:06.831-0400	0 document(s) restored successfully. 0 document(s) failed to restore.
      

      But just restoring w/o nsInclude works fine:

      ~/mongo $ ./mongodb-4.2.0-rc2/bin/mongorestore -u kayadmin -p abc123 --authenticationDatabase=admin dump/
      2019-07-08T14:03:12.689-0400	preparing collections to restore from
      2019-07-08T14:03:12.693-0400	reading metadata for test.cafés from dump/test/caf%C3%A9s.metadata.json
      2019-07-08T14:03:12.693-0400	reading metadata for test.ημερολόγιο from dump/test/%CE%B7%CE%BC%CE%B5%CF%81%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF.metadata.json
      2019-07-08T14:03:12.727-0400	restoring test.ημερολόγιο from dump/test/%CE%B7%CE%BC%CE%B5%CF%81%CE%BF%CE%BB%CF%8C%CE%B3%CE%B9%CE%BF.bson
      2019-07-08T14:03:12.741-0400	no indexes to restore
      2019-07-08T14:03:12.741-0400	finished restoring test.ημερολόγιο (1 document, 0 failures)
      2019-07-08T14:03:12.757-0400	restoring test.cafés from dump/test/caf%C3%A9s.bson
      2019-07-08T14:03:12.766-0400	no indexes to restore
      2019-07-08T14:03:12.766-0400	finished restoring test.cafés (1 document, 0 failures)
      2019-07-08T14:03:12.766-0400	restoring users from dump/admin/system.users.bson
      2019-07-08T14:03:12.806-0400	restoring roles from dump/admin/system.roles.bson
      2019-07-08T14:03:12.890-0400	2 document(s) restored successfully. 0 document(s) failed to restore.
      

            Assignee:
            sanika.phanse@mongodb.com Sanika Phanse (Inactive)
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Evgeni Dobranov, Matthew Chiaravalloti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: