0

I had the following command but it doesn't work. Please help.

mongodump --uri="130.164.10.1:27017,130.164.10.2:27017,130.164.10.3:27017/?replicaSet=rs0" -d mydb -u admin -p myPass -o C:\myDump

I am using mongodb 4.2. I got error "cannot specify --username and --uri". Thank you.

jxStackOverflow
  • 328
  • 1
  • 7
  • 17

1 Answers1

1

The URI already includes credentials and the database, so either use the --uri option and provide the credentials and database name in the URI or use the -d -u -p options along with --host etc.

The URI structure is explained here.

Try:

--uri="mongodb://admin:myPass@130.164.10.1:27017,130.164.10.2:27017,130.164.10.3:27017/mydb?replicaSet=rs0"
D. SM
  • 13,584
  • 3
  • 12
  • 21