MongoDB Help Documentation

Source: Internet
Author: User
Tags createindex deprecated findone mongodb mongo shell

When you log in to MongoDB, you can use the Help command to view the assistance Document System-level Help documentation > Helpdb.help () Help on DB methods # Database-Level Assistance Document DB.MYCOLL.HELP () Assist on Collectio N Methods # Collection-Level help document SH.HELP () sharding Helpers # Help document about Shards Rs.help () replica set HELPERSHELP Admin Administrative Assist # Management Help connection connecting to a DB Help # connecting to a database assist document helping keys key Shortcutshelp misc Misc Things to Knowhelp Mr MapReduce  show DBS Show Database names # show databases show collections show collections in the current database # Display collection show users show user s in current database # Show user Show profile show most recent system.profile entries with time >= 1ms # show Profileshow logs Show the accessible logger names # shows the log (just what logs are shown) show log [name] prints out the last segment of log in memory, ' global ' I s default # Displays the contents of the specified log use <db_name> set current database # switches to the specified databases and, if not present, creates the default Db.foo.find () List objects in Collectio n Foo # queries all data Db.foo.find ({a:1}) List objects in Foo where a = = 1 # query specifies data 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>  database level help document uses DB. database name Called. Help ()   For example: > db.mymongo.help () dbcollection helpdb.mymongo.find (). Help ()-Show dbcursor Help # Query Help document 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 Que ry, optional Parameters are:limit, skip, hint, MaxTimeMSdb.mymongo.copyTo (newcoll)-duplicates collection by copying all Documents to Newcoll; No indexes is 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 p Arameters are:w, Wtimeout, Jdb.mymonGo.deletemany (filter, <optional params>)-Delete all matching documents, optional parameters are:w, Wtimeout, JD B.MYMONGO.DISTINCT (key, query, <optional params>)-e.g. db.mymongo.distinct (' x '), optional parameters Are:maxt ImeMSdb.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 a optional query filter. Fields are 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, ret UrnNewDocumentdb.mymongo.findOneAndUpdate (filter, update, <optional params>)-Update first matching document, op tional parameters are:projection, sort, maxtimems, Upsert, ReturnNewDocumentdb.mymongo.getDB () Get DB object associated W ITH 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 is : W, Wtimeout, Jdb.mymongo.insertMany ([objects], <optional params>)-Insert multiple documents, optional Paramete Rs 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, <dro ptarget>) 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, Ind Exdetailskey: <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 both flags, Y OU can pass an object with Fields:upserT, Multidb.mymongo.updateOne (filter, update, <optional params>)-Update the first matching document, optional par Ameters 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.getShardVe Rsion ()-only if use with shardingdb.mymongo.getShardDistribution ()-Prints statistics about data distribution in the C Lusterdb.mymongo.getSplitKeysForChunks (<maxChunkSize>)-calculates split points over all chunks and returns split ter Functiondb.mymongo.getWriteConcern ()-Returns the write concern used for all operations on this collection, inherited From server/db if Setdb.mymongo.setWriteConcern (<write concern doc>)-sets the write concern for writes to the C Ollectiondb.mymongo.unsetWriteConcern (<write concern doc>)-Unsets The write concern for writes to the collection   Table-level help document, using the DB. Name of the table. hELP () such as:> 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 is 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 Paramet ERs are:w, Wtimeout, Jdb.noPK.deleteMany (filter, <optional params>)-Delete all matching documents, optional par Ameters 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 (k Eypattern[,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 are 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 (fi Lter, 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, Opti Onal parameters are:projection, sort, maxtimems, Upsert, ReturnNewDocumentdb.noPK.getDB () Get DB object associated with C Ollectiondb.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, W Timeout, 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], &L T;optional params>)-Performs an aggregation on a collection; Returns a Cursordb.noPK.remove (query) Db.noPK.replaceOne (filter, replacement, <optional params>)-Replace the FIR St matching document, optional parameTers Are:upsert, W, Wtimeout, Jdb.noPK.renameCollection (NewName, <dropTarget>) renames the collection.db.noPK.ru Ncommand (name, <options>) runs a DB command with the given name where the first param is the collection namedb.no Pk.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 ()-Si Ze in bytes of "All" indexesdb.noPK.totalSize ()-Storage allocated for all data and indexesdb.noPK.update (query, OBJEC t[, Upsert_bool, Multi_bool])-instead of the flags, you can pass a object with Fields:upsert, Multidb.noPK.updateOne ( Filter, UPDATE, <optional params>)-Update the first matching document, optional parameters Are:upsert, W, Wtime Out, Jdb.noPK.updateMany (filter, update, <optional params>)-Update all matching documents, optional parameters a Re:upsert, W, Wtimeout, JDB.NOpk.validate (<full>)-SLOWdb.noPK.getShardVersion ()-only if use with shardingdb.noPK.getShardDistribution ()- Prints statistics about data distribution in the Clusterdb.noPK.getSplitKeysForChunks (<maxChunkSize>)-Calculate S split points over all chunks and returns splitter Functiondb.noPK.getWriteConcern ()-Returns the write concern used for Any operations on the 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 WRI Te concern for writes to the collection>

MongoDB Help documentation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.