Created
February 1, 2011 15:20
-
-
Save methodin/805996 to your computer and use it in GitHub Desktop.
Useful commands/examples for Mongo
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
// Adding a user auth to a DB (read/write, add true as a third param for read-only) | |
use somedb | |
db.addUser("username","pasword") | |
// Update an entry (don't forget $set or it will be replace only with what is provided) | |
db.gadgets.update({key:"Some criteria"},{$set:{weight:17.6}}) | |
// Dump a database/collection | |
mongodump -d databasename -c collection -o . | |
// Start a mongo instance with authentication required | |
mongod --fork --logpath /var/log/mongodb.log --logappend --auth & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment