Created
June 24, 2011 15:28
-
-
Save mfo/1045022 to your computer and use it in GitHub Desktop.
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
from mongo console : | |
# a few usefull command on mongo cli | |
show dbs | |
use sharypic_development | |
# adding sparse index | |
db.users.dropIndex("invite_code_1") | |
db.users.ensureIndex({invide_code: 1}, {sparse: true, unique: true}) | |
# rename a datbase | |
use 'sharypic-staging' | |
db.copyDatabase("sharypic-staging", "sharypic_development", this) | |
db.getCollecitonNames() | |
# querying object id | |
{_id: ObjectId('blah')} | |
# removing stuffs | |
db.pictures.remove({ $and: [ {"event_id": ObjectId('4e11adb84fcd230001000044')}, {"_type": {$ne: "TwitterSource"}}] }) | |
# restore a db | |
mongorestore -vvv sharypic_development |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment