0

During my studying of MongoDB I tried to dump a collection from training course's mongo database. I tried both mongodump and mongoexport. My shell command is like

mongoexport --uri="mongodb://<my-username>:<my_password>@<replica-1>.mongodb.net:27017,<replica-2>.mongodb.net:27017,<replica-3>.mongodb.net:27017/<database>?replicaSet=<replica-set>" --collection=<collection-name> --out=<collection-name>.json --ssl

When I run the command, nothing happened: no response, no new local files, no errors, only cursor flashes.

How can I export collections by the uri?

Yuriy L.
  • 95
  • 12
  • Please run the command with `--verbose` and paste the output here – tbhaxor Jan 23 '21 at 09:06
  • @tbhaxor, both `mongodump` and `mongoexport` were tried with `--verbose`. The same result: nothing happened, cursor flashed only. – Yuriy L. Jan 23 '21 at 09:09
  • Maybe you need to specify the authentication database, see https://stackoverflow.com/questions/63754742/authentication-failure-while-trying-to-save-to-mongodb/63755470#63755470 – Wernfried Domscheit Jan 23 '21 at 11:58

1 Answers1

0
--forceTableScan 

option can be used along with mongodump & --uri option

mongodump --uri mongodb+srv://<user_name>:@.mongodb.net/db_name --forceTableScan --collection <collection_name> --out ./dump/

Sandy
  • 946
  • 11
  • 14