Created
July 18, 2019 07:51
-
-
Save vikas-git/c06e018ee9c391480e62e025d5a2bd66 to your computer and use it in GitHub Desktop.
Some common and important commands for MONGODB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For Dump and Restore : | |
mongodump --db=<old_db_name> --collection=<collection_name> --out=data/ | |
mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson | |
Loop on mongodb query: | |
db.users.find().forEach( function(myDoc) { print( "user: " + myDoc.name ); } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment