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

mongorestore should not try to list collections

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: mongorestore
    • Labels:
      None

      I'm trying to restore an archive, and mongorestore keeps running into an error that it's "not allowed to do action [listCollections] on [mydb.]"

      I don't want it to list collections. I've specified exactly what collection to restore:

      Output

      $ mongorestore --uri=$MONGO_URL --archive=somefile.mongodump --gzip -d mydb -c mycol
      2020-06-12T18:46:45.000-0700 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
      2020-06-12T18:46:45.047-0700 preparing collections to restore from
      2020-06-12T18:46:45.104-0700 finished restoring mydb.mycol (0 documents, 0 failures)
      2020-06-12T18:46:45.104-0700 Failed: mydb.mycol: error reading database: (AtlasError) user is not allowed to do action [listCollections] on [mydb.]
      2020-06-12T18:46:45.104-0700 0 document(s) restored successfully. 0 document(s) failed to restore.

      $ mongorestore --uri=$MONGO_URL --archive=somefile.mongodump --gzip --nsInclude mydb.mycol
      2020-06-12T18:53:10.249-0700 preparing collections to restore from
      2020-06-12T18:53:10.300-0700 finished restoring mydb.mycol (0 documents, 0 failures)
      2020-06-12T18:53:10.300-0700 Failed: mydb.mycol: error reading database: (AtlasError) user is not allowed to do action [listCollections] on [mydb.]
      2020-06-12T18:53:10.300-0700 0 document(s) restored successfully. 0 document(s) failed to restore.

            Assignee:
            tim.fogarty@mongodb.com Tim Fogarty
            Reporter:
            dandv Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: