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

Mongorestore with --dir but without -d should give nicer warning msg

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.6
    • Component/s: mongorestore
    • None

      RunningĀ 

      mongorestore --uri=mongodb+srv://USER@m0-cluster-xyz.mongodb.net/mflix --ssl --dir=mflix/

      gives:

      2019-02-25T09:51:30.364+0100	preparing collections to restore from
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/comments.bson", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/comments.metadata.json", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/movies.bson", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/movies.metadata.json", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/sessions.bson", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/sessions.metadata.json", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/theaters.bson", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/theaters.metadata.json", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/users.bson", skipping...
      2019-02-25T09:51:30.365+0100	don't know what to do with file "mflix/users.metadata.json", skipping...
      2019-02-25T09:51:30.366+0100	done
      

      whereas:

       mongorestore --uri=mongodb+srv://USER@m0-cluster-xyz.mongodb.net/mflix --ssl -d mflix --dir=mflix/

      restores the collections as expected.

      Since I provided a database name in the URI I was surprised by this behaviour. Can we tweak the parameter parsing to give a warning such as "Cannot restore dumped collections without explicit -d database parameter"

            Assignee:
            Unassigned Unassigned
            Reporter:
            nicholas.cottrell@mongodb.com Nic Cottrell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: