Skip to content

How to use mongodump with a standard mongo connection uri?

You can easily take mongodump from a connection URI by passing –uri flag to the mongodump tool.

Advertisements

Syntax

mongodump --uri <your connection uri>
Advertisements

Example

$sudo mongodump --uri mongodb+srv://rdeva123:rdeva123@cluster0.yknfh.mongodb.net/myFirstDatabase --forceTableScan
 
2021-08-21T20:24:00.243+0530	writing myFirstDatabase.leaders to 
2021-08-21T20:24:00.244+0530	writing myFirstDatabase.partners to 
2021-08-21T20:24:00.244+0530	writing myFirstDatabase.users to 
2021-08-21T20:24:02.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:02.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:02.409+0530	
2021-08-21T20:24:03.576+0530	done dumping myFirstDatabase.users (4 documents)
2021-08-21T20:24:05.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:05.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:05.409+0530	
2021-08-21T20:24:08.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:08.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:08.409+0530	
2021-08-21T20:24:11.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:11.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:11.409+0530	
2021-08-21T20:24:14.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:14.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:14.410+0530	
2021-08-21T20:24:17.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:17.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:17.409+0530	
2021-08-21T20:24:20.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:20.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:20.409+0530	
2021-08-21T20:24:23.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:23.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:23.409+0530	
2021-08-21T20:24:26.409+0530	[........................]  myFirstDatabase.partners  0/5  (0.0%)
2021-08-21T20:24:26.409+0530	[........................]   myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:26.409+0530	
2021-08-21T20:24:27.694+0530	[########################]  myFirstDatabase.partners  5/5  (100.0%)
2021-08-21T20:24:27.694+0530	done dumping myFirstDatabase.partners (5 documents)
2021-08-21T20:24:29.410+0530	[........................]  myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:32.409+0530	[........................]  myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:35.409+0530	[........................]  myFirstDatabase.leaders  0/5  (0.0%)
2021-08-21T20:24:35.890+0530	[########################]  myFirstDatabase.leaders  5/5  (100.0%)
2021-08-21T20:24:35.890+0530	done dumping myFirstDatabase.leaders (5 documents)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.