MongoDB幫助信息:db方法,collection方法

  1. mongos> db.help()  
  2. DB methods:  
  3.         db.addUser(username, password[, readOnly=false])  
  4.         db.adminCommand(nameOrDocument) - switches to 'admin' db, and runs command [ just calls db.runCommand(...) ]  
  5.         db.auth(username, password)  
  6.         db.cloneDatabase(fromhost)  
  7.         db.commandHelp(name) returns the help for the command  
  8.         db.copyDatabase(fromdb, todb, fromhost)  
  9.         db.createCollection(name, { size : ..., capped : ..., max : ... } )  
  10.         db.currentOp() displays currently executing operations in the db  
  11.         db.dropDatabase()  
  12.         db.eval(func, args) run code server-side  
  13.         db.fsyncLock() flush data to disk and lock server for backups  
  14.         db.fsyncUnlock() unlocks server following a db.fsyncLock()  
  15.         db.getCollection(cname) same as db['cname'] or db.cname  
  16.         db.getCollectionNames()  
  17.         db.getLastError() - just returns the err msg string  
  18.         db.getLastErrorObj() - return full status object  
  19.         db.getMongo() get the server connection object  
  20.         db.getMongo().setSlaveOk() allow queries on a replication slave server  
  21.         db.getName()  
  22.         db.getPrevError()  
  23.         db.getProfilingLevel() - deprecated  
  24.         db.getProfilingStatus() - returns if profiling is on and slow threshold  
  25.         db.getReplicationInfo()  
  26.         db.getSiblingDB(name) get the db at the same server as this one  
  27.         db.hostInfo() get details about the server's host  
  28.         db.isMaster() check replica primary status  
  29.         db.killOp(opid) kills the current operation in the db  
  30.         db.listCommands() lists all the db commands  
  31.         db.loadServerScripts() loads all the scripts in db.system.js  
  32.         db.logout()  
  33.         db.printCollectionStats()  
  34.         db.printReplicationInfo()  
  35.         db.printShardingStatus()  
  36.         db.printSlaveReplicationInfo()  
  37.         db.removeUser(username)  
  38.         db.repairDatabase()  
  39.         db.resetError()  
  40.         db.runCommand(cmdObj) run a database command.  if cmdObj is a string, turns it into { cmdObj : 1 }  
  41.         db.serverStatus()  
  42.         db.setProfilingLevel(level,<slowms>) 0=off 1=slow 2=all  
  43.         db.setVerboseShell(flag) display extra information in shell output  
  44.         db.shutdownServer()  
  45.         db.stats()  
  46.         db.version() current version of the server  
  47. mongos> 

 

創(chuàng)新互聯(lián)是一家專業(yè)提供利辛企業(yè)網(wǎng)站建設(shè),專注與成都做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)、H5響應(yīng)式網(wǎng)站、小程序制作等業(yè)務(wù)。10年已為利辛眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站設(shè)計(jì)公司優(yōu)惠進(jìn)行中。

  1. mongos> db.myCollection.help()  
  2. DBCollection help  
  3.         db.myCollection.find().help() - show DBCursor help  
  4.         db.myCollection.count()  
  5.         db.myCollection.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied.  
  6.         db.myCollection.convertToCapped(maxBytes) - calls {convertToCapped:'myCollection', size:maxBytes}} command  
  7.         db.myCollection.dataSize()  
  8.         db.myCollection.distinct( key ) - e.g. db.myCollection.distinct( 'x' )  
  9.         db.myCollection.drop() drop the collection  
  10.         db.myCollection.dropIndex(index) - e.g. db.myCollection.dropIndex( "indexName" ) or db.myCollection.dropIndex( { "indexKey" : 1 } )  
  11.         db.myCollection.dropIndexes()  
  12.         db.myCollection.ensureIndex(keypattern[,options]) - options is an object with these possible fields: name, unique, dropDups  
  13.         db.myCollection.reIndex()  
  14.         db.myCollection.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return. e.g. db.myCollection.find( {x:77} , {name:1, x:1} )  
  15.         db.myCollection.find(...).count()  
  16.         db.myCollection.find(...).limit(n)  
  17.         db.myCollection.find(...).skip(n)  
  18.         db.myCollection.find(...).sort(...)  
  19.         db.myCollection.findOne([query])  
  20.         db.myCollection.findAndModify( { update : ... , remove : bool [, query:{}, sort: {}, 'new': false] } )  
  21.         db.myCollection.getDB() get DB object associated with collection  
  22.         db.myCollection.getIndexes()  
  23.         db.myCollection.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )  
  24.         db.myCollection.insert(obj)  
  25.         db.myCollection.mapReduce( mapFunction , reduceFunction , <optional params> )  
  26.         db.myCollection.remove(query)  
  27.         db.myCollection.renameCollection( newName , <dropTarget> ) renames the collection.  
  28.         db.myCollection.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection name  
  29.         db.myCollection.save(obj)  
  30.         db.myCollection.stats()  
  31.         db.myCollection.storageSize() - includes free space allocated to this collection  
  32.         db.myCollection.totalIndexSize() - size in bytes of all the indexes  
  33.         db.myCollection.totalSize() - storage allocated for all data and indexes  
  34.         db.myCollection.update(query, object[, upsert_bool, multi_bool]) - instead of two flags, you can pass an object with fields: upsert, multi  
  35.         db.myCollection.validate( <full> ) - SLOW  
  36.         db.myCollection.getShardVersion() - only for use with sharding  
  37.         db.myCollection.getShardDistribution() - prints statistics about data distribution in the cluster  
  38.         db.myCollection.getSplitKeysForChunks( <maxChunkSize> ) - calculates split points over all chunks and returns splitter function 

 

網(wǎng)頁題目:MongoDB幫助信息:db方法,collection方法
分享鏈接:http://muchs.cn/article38/jehpsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、App開發(fā)、建站公司、網(wǎng)頁設(shè)計(jì)公司、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)