Last active
December 15, 2015 23:39
-
-
Save sydneyitguy/5341688 to your computer and use it in GitHub Desktop.
mongo queries
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
db.getMongo().setSlaveOk() | |
db.currentOp() | |
db.killOp() | |
show dbs | |
show collections | |
db.events.find({event: 'view', date: { '$gte': 1338472800, '$lt': 1341064800 } }).count() | |
// Stupid query: Change a field type from string to number | |
db.COLLECTION_NAME.find({FIELD_NAME: {$type:2}}).limit(1000000).forEach( function(x) { | |
x.subject = Number(x.subject); db.events.save(x); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment