Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2011 15:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save methodin/805996 to your computer and use it in GitHub Desktop.
Useful commands/examples for Mongo
// Adding a user auth to a DB (read/write, add true as a third param for read-only)
use somedb
// 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