Last active
December 21, 2015 19:48
-
-
Save madhavan-rp/6356449 to your computer and use it in GitHub Desktop.
Mongo Shell Commands Quick Reference
This file contains 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
//Import | |
mongoimport --db myDB --collection myCollection --file myJSONFile.json | |
//Export | |
mongoexport --db myDB --collection myCollection --out myJSONFile.json |
This file contains 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
//Starting mongod with text search enabled | |
mongod --setParameter textSearchEnabled=true | |
//enable text search after starting normally | |
db.adminCommand( { setParameter : 1, textSearchEnabled : true } ) | |
//Text Search on all fields | |
db.collection.ensureIndex({ "$**": "text" },{ name: "TextIndex" }) | |
//Search a collection | |
db.collection.runCommand("text",{search:"where is the party?"}) | |
//Remove all indexes | |
db.collection.dropIndexes() | |
//Update multiple documents | |
db.collection.update({'name' : 'Maddy'},{$set:{'awesomeness':'High'}},{upsert:false, multi:true}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment