0

I received this error when I run command of mongodump

mongodump --db admin --out /DatabaseBackups/

error getting collections for database admin: error running listCollections. Database: admin Err: not authorized on admin to execute command { listCollections: 1, cursor: {}, $readPreference: { mode: "secondaryPreferred" }, $db: "admin" }

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56

1 Answers1

0

You need to provide username and password in order to authorize:

mongodump -h SERVER_NAME:PORT -d DATABASE_NAME -u DATABASE_USER -p PASSWORD
Volodymyr
  • 1,360
  • 1
  • 7
  • 12