Created
October 9, 2011 05:14
-
-
Save zolzaya/1273334 to your computer and use it in GitHub Desktop.
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.users.help() | |
DBCollection help | |
db.users.find().help() - show DBCursor help | |
db.users.count() | |
db.users.dataSize() | |
db.users.distinct( key ) - eg. db.users.distinct( 'x' ) | |
db.users.drop() drop the collection | |
db.users.dropIndex(name) | |
db.users.dropIndexes() | |
db.users.ensureIndex(keypattern[,options]) - options is an object with these possible fields: name, unique, dropDups | |
db.users.reIndex() | |
db.users.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return. | |
e.g. db.users.find( {x:77} , {name:1, x:1} ) | |
db.users.find(...).count() | |
db.users.find(...).limit(n) | |
db.users.find(...).skip(n) | |
db.users.find(...).sort(...) | |
db.users.findOne([query]) | |
db.users.findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } ) | |
db.users.getDB() get DB object associated with collection | |
db.users.getIndexes() | |
db.users.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } ) | |
db.users.mapReduce( mapFunction , reduceFunction , <optional params> ) | |
db.users.remove(query) | |
db.users.renameCollection( newName , <dropTarget> ) renames the collection. | |
db.users.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection name | |
db.users.save(obj) | |
db.users.stats() | |
db.users.storageSize() - includes free space allocated to this collection | |
db.users.totalIndexSize() - size in bytes of all the indexes | |
db.users.totalSize() - storage allocated for all data and indexes | |
db.users.update(query, object[, upsert_bool, multi_bool]) | |
db.users.validate( <full> ) - SLOW | |
db.users.getShardVersion() - only for use with sharding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment