標籤:ali str distinct false limit nis height 文檔 replica
當登入到mongoDB 之後 可以使用help 命令查看協助文檔系統級協助文檔> helpdb.help() help on db methods # 資料庫層級協助文檔db.mycoll.help() help on collection methods # 集合層級協助文檔sh.help() sharding helpers # 關於分區的協助文檔rs.help() replica set helpershelp admin administrative help # 管理員協助文檔help connect connecting to a db help # 串連資料庫協助文檔help keys key shortcutshelp misc misc things to knowhelp mr mapreduce show dbs show database names # 顯示資料庫show collections show collections in current database # 顯示集合show users show users in current database # 顯示使用者show profile show most recent system.profile entries with time >= 1ms # 顯示profileshow logs show the accessible logger names # 顯示日誌(只是顯示有哪些日誌)show log [name] prints out the last segment of log in memory, ‘global‘ is default # 顯示指定日誌的內容use <db_name> set current database # 切換到指定資料庫,如果不存在則預設建立db.foo.find() list objects in collection foo # 查詢所有資料db.foo.find( { a : 1 } ) list objects in foo where a == 1 # 查詢指定資料it result of the last line evaluated; use to further iterateDBQuery.shellBatchSize = x set default number of items to display on shellexit quit the mongo shell> 資料庫層級協助文檔 使用db.資料庫名稱.help() 例如: > db.mymongo.help()DBCollection helpdb.mymongo.find().help() - show DBCursor help # 查詢 協助文檔db.mymongo.bulkWrite( operations, <optional params> ) - bulk execute write operations, optional parameters are: w, wtimeout, jdb.mymongo.count( query = {}, <optional params> ) - count the number of documents that matches the query, optional parameters are: limit, skip, hint, maxTimeMSdb.mymongo.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied.db.mymongo.convertToCapped(maxBytes) - calls {convertToCapped:‘mymongo‘, size:maxBytes}} commanddb.mymongo.createIndex(keypattern[,options])db.mymongo.createIndexes([keypatterns], <options>)db.mymongo.dataSize()db.mymongo.deleteOne( filter, <optional params> ) - delete first matching document, optional parameters are: w, wtimeout, jdb.mymongo.deleteMany( filter, <optional params> ) - delete all matching documents, optional parameters are: w, wtimeout, jdb.mymongo.distinct( key, query, <optional params> ) - e.g. db.mymongo.distinct( ‘x‘ ), optional parameters are: maxTimeMSdb.mymongo.drop() drop the collectiondb.mymongo.dropIndex(index) - e.g. db.mymongo.dropIndex( "indexName" ) or db.mymongo.dropIndex( { "indexKey" : 1 } )db.mymongo.dropIndexes()db.mymongo.ensureIndex(keypattern[,options]) - DEPRECATED, use createIndex() insteaddb.mymongo.explain().help() - show explain helpdb.mymongo.reIndex()db.mymongo.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return.e.g. db.mymongo.find( {x:77} , {name:1, x:1} )db.mymongo.find(...).count()db.mymongo.find(...).limit(n)db.mymongo.find(...).skip(n)db.mymongo.find(...).sort(...)db.mymongo.findOne([query], [fields], [options], [readConcern])db.mymongo.findOneAndDelete( filter, <optional params> ) - delete first matching document, optional parameters are: projection, sort, maxTimeMSdb.mymongo.findOneAndReplace( filter, replacement, <optional params> ) - replace first matching document, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocumentdb.mymongo.findOneAndUpdate( filter, update, <optional params> ) - update first matching document, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocumentdb.mymongo.getDB() get DB object associated with collectiondb.mymongo.getPlanCache() get query plan cache associated with collectiondb.mymongo.getIndexes()db.mymongo.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )db.mymongo.insert(obj)db.mymongo.insertOne( obj, <optional params> ) - insert a document, optional parameters are: w, wtimeout, jdb.mymongo.insertMany( [objects], <optional params> ) - insert multiple documents, optional parameters are: w, wtimeout, jdb.mymongo.mapReduce( mapFunction , reduceFunction , <optional params> )db.mymongo.aggregate( [pipeline], <optional params> ) - performs an aggregation on a collection; returns a cursordb.mymongo.remove(query)db.mymongo.replaceOne( filter, replacement, <optional params> ) - replace the first matching document, optional parameters are: upsert, w, wtimeout, jdb.mymongo.renameCollection( newName , <dropTarget> ) renames the collection.db.mymongo.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection namedb.mymongo.save(obj)db.mymongo.stats({scale: N, indexDetails: true/false, indexDetailsKey: <index key>, indexDetailsName: <index name>})db.mymongo.storageSize() - includes free space allocated to this collectiondb.mymongo.totalIndexSize() - size in bytes of all the indexesdb.mymongo.totalSize() - storage allocated for all data and indexesdb.mymongo.update( query, object[, upsert_bool, multi_bool] ) - instead of two flags, you can pass an object with fields: upsert, multidb.mymongo.updateOne( filter, update, <optional params> ) - update the first matching document, optional parameters are: upsert, w, wtimeout, jdb.mymongo.updateMany( filter, update, <optional params> ) - update all matching documents, optional parameters are: upsert, w, wtimeout, jdb.mymongo.validate( <full> ) - SLOWdb.mymongo.getShardVersion() - only for use with shardingdb.mymongo.getShardDistribution() - prints statistics about data distribution in the clusterdb.mymongo.getSplitKeysForChunks( <maxChunkSize> ) - calculates split points over all chunks and returns splitter functiondb.mymongo.getWriteConcern() - returns the write concern used for any operations on this collection, inherited from server/db if setdb.mymongo.setWriteConcern( <write concern doc> ) - sets the write concern for writes to the collectiondb.mymongo.unsetWriteConcern( <write concern doc> ) - unsets the write concern for writes to the collection 表層級協助文檔,使用db.表的名稱.help()例如:> db.noPK.help()DBCollection helpdb.noPK.find().help() - show DBCursor helpdb.noPK.bulkWrite( operations, <optional params> ) - bulk execute write operations, optional parameters are: w, wtimeout, jdb.noPK.count( query = {}, <optional params> ) - count the number of documents that matches the query, optional parameters are: limit, skip, hint, maxTimeMSdb.noPK.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied.db.noPK.convertToCapped(maxBytes) - calls {convertToCapped:‘noPK‘, size:maxBytes}} commanddb.noPK.createIndex(keypattern[,options])db.noPK.createIndexes([keypatterns], <options>)db.noPK.dataSize()db.noPK.deleteOne( filter, <optional params> ) - delete first matching document, optional parameters are: w, wtimeout, jdb.noPK.deleteMany( filter, <optional params> ) - delete all matching documents, optional parameters are: w, wtimeout, jdb.noPK.distinct( key, query, <optional params> ) - e.g. db.noPK.distinct( ‘x‘ ), optional parameters are: maxTimeMSdb.noPK.drop() drop the collectiondb.noPK.dropIndex(index) - e.g. db.noPK.dropIndex( "indexName" ) or db.noPK.dropIndex( { "indexKey" : 1 } )db.noPK.dropIndexes()db.noPK.ensureIndex(keypattern[,options]) - DEPRECATED, use createIndex() insteaddb.noPK.explain().help() - show explain helpdb.noPK.reIndex()db.noPK.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return.e.g. db.noPK.find( {x:77} , {name:1, x:1} )db.noPK.find(...).count()db.noPK.find(...).limit(n)db.noPK.find(...).skip(n)db.noPK.find(...).sort(...)db.noPK.findOne([query], [fields], [options], [readConcern])db.noPK.findOneAndDelete( filter, <optional params> ) - delete first matching document, optional parameters are: projection, sort, maxTimeMSdb.noPK.findOneAndReplace( filter, replacement, <optional params> ) - replace first matching document, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocumentdb.noPK.findOneAndUpdate( filter, update, <optional params> ) - update first matching document, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocumentdb.noPK.getDB() get DB object associated with collectiondb.noPK.getPlanCache() get query plan cache associated with collectiondb.noPK.getIndexes()db.noPK.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )db.noPK.insert(obj)db.noPK.insertOne( obj, <optional params> ) - insert a document, optional parameters are: w, wtimeout, jdb.noPK.insertMany( [objects], <optional params> ) - insert multiple documents, optional parameters are: w, wtimeout, jdb.noPK.mapReduce( mapFunction , reduceFunction , <optional params> )db.noPK.aggregate( [pipeline], <optional params> ) - performs an aggregation on a collection; returns a cursordb.noPK.remove(query)db.noPK.replaceOne( filter, replacement, <optional params> ) - replace the first matching document, optional parameters are: upsert, w, wtimeout, jdb.noPK.renameCollection( newName , <dropTarget> ) renames the collection.db.noPK.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection namedb.noPK.save(obj)db.noPK.stats({scale: N, indexDetails: true/false, indexDetailsKey: <index key>, indexDetailsName: <index name>})db.noPK.storageSize() - includes free space allocated to this collectiondb.noPK.totalIndexSize() - size in bytes of all the indexesdb.noPK.totalSize() - storage allocated for all data and indexesdb.noPK.update( query, object[, upsert_bool, multi_bool] ) - instead of two flags, you can pass an object with fields: upsert, multidb.noPK.updateOne( filter, update, <optional params> ) - update the first matching document, optional parameters are: upsert, w, wtimeout, jdb.noPK.updateMany( filter, update, <optional params> ) - update all matching documents, optional parameters are: upsert, w, wtimeout, jdb.noPK.validate( <full> ) - SLOWdb.noPK.getShardVersion() - only for use with shardingdb.noPK.getShardDistribution() - prints statistics about data distribution in the clusterdb.noPK.getSplitKeysForChunks( <maxChunkSize> ) - calculates split points over all chunks and returns splitter functiondb.noPK.getWriteConcern() - returns the write concern used for any operations on this collection, inherited from server/db if setdb.noPK.setWriteConcern( <write concern doc> ) - sets the write concern for writes to the collectiondb.noPK.unsetWriteConcern( <write concern doc> ) - unsets the write concern for writes to the collection>
mongoDB 協助文檔