最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

詳解MongoDB管理命令

 更新時(shí)間:2016年01月04日 14:16:05   作者:Joans  
MongoDB是一個(gè)NoSQL數(shù)據(jù)庫(kù)系統(tǒng):一個(gè)數(shù)據(jù)庫(kù)可以包含多個(gè)集合(Collection),每個(gè)集合對(duì)應(yīng)于關(guān)系數(shù)據(jù)庫(kù)中的表;而每個(gè)集合中可以存儲(chǔ)一組由列標(biāo)識(shí)的記錄,列是可以自由定義的,非常靈活,由一組列標(biāo)識(shí)的實(shí)體的集合對(duì)應(yīng)于關(guān)系數(shù)據(jù)庫(kù)表中的行

MongoDB是一個(gè)NoSQL數(shù)據(jù)庫(kù)系統(tǒng):一個(gè)數(shù)據(jù)庫(kù)可以包含多個(gè)集合(Collection),每個(gè)集合對(duì)應(yīng)于關(guān)系數(shù)據(jù)庫(kù)中的表;而每個(gè)集合中可以存儲(chǔ)一組由列標(biāo)識(shí)的記錄,列是可以自由定義的,非常靈活,由一組列標(biāo)識(shí)的實(shí)體的集合對(duì)應(yīng)于關(guān)系數(shù)據(jù)庫(kù)表中的行。下面通過(guò)熟悉MongoDB的基本管理命令,來(lái)了解MongoDB提供的DBMS的基本功能和行為。 

MongoDB命令幫助系統(tǒng) 

在安裝MongoDB后,啟動(dòng)服務(wù)器進(jìn)程(mongod),可以通過(guò)在客戶(hù)端命令mongo實(shí)現(xiàn)對(duì)MongoDB的管理和監(jiān)控??匆幌翸ongoDB的命令幫助系統(tǒng):

 root@dev:~# mongo
 MongoDB shell version: ..
 connecting to: test
 > help
     db.help()          help on db methods
     db.mycoll.help()       help on collection methods
     rs.help()          help on replica set methods
     help connect         connecting to a db help
     help admin          administrative help
     help misc          misc things to know
     help mr           mapreduce help
     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 >= ms
     use <db_name>        set current database
     db.foo.find()        list objects in collection foo
     db.foo.find( { a : } )   list objects in foo where a == 
     it              result of the last line evaluated; use to further iterate
     DBQuery.shellBatchSize = x  set default number of items to display on shell
     exit             quit the mongo shell 

這是MongoDB最頂層的命令列表,主要告訴我們管理數(shù)據(jù)庫(kù)相關(guān)的一些抽象的范疇:數(shù)據(jù)庫(kù)操作幫助、集合操作幫助、管理幫助。如果你想了解數(shù)據(jù)庫(kù)操作更詳細(xì)的幫助命令,可以直接使用db.help(),如下所示:

 db.help()
 DB methods:
     db.addUser(username, password[, readOnly=false])
     db.auth(username, password)
     db.cloneDatabase(fromhost)
     db.commandHelp(name) returns the help for the command
     db.copyDatabase(fromdb, todb, fromhost)
     db.createCollection(name, { size : ..., capped : ..., max : ... } )
     db.currentOp() displays the current operation in the db
     db.dropDatabase()
     db.eval(func, args) run code server-side
     db.getCollection(cname) same as db['cname'] or db.cname
     db.getCollectionNames()
     db.getLastError() - just returns the err msg string
     db.getLastErrorObj() - return full status object
     db.getMongo() get the server connection object
     db.getMongo().setSlaveOk() allow this connection to read from the nonmaster member of a replica pair
     db.getName()
     db.getPrevError()
     db.getProfilingLevel() - deprecated
     db.getProfilingStatus() - returns if profiling is on and slow threshold 
     db.getReplicationInfo()
     db.getSiblingDB(name) get the db at the same server as this one
     db.isMaster() check replica primary status
     db.killOp(opid) kills the current operation in the db
     db.listCommands() lists all the db commands
     db.printCollectionStats()
     db.printReplicationInfo()
     db.printSlaveReplicationInfo()
     db.printShardingStatus()
     db.removeUser(username)
     db.repairDatabase()
     db.resetError()
     db.runCommand(cmdObj) run a database command. if cmdObj is a string, turns it into { cmdObj : }
     db.serverStatus()
     db.setProfilingLevel(level,<slowms>) =off =slow =all
     db.shutdownServer()
     db.stats()
     db.version() current version of the server
     db.getMongo().setSlaveOk() allow queries on a replication slave server 

對(duì)數(shù)據(jù)庫(kù)進(jìn)行管理和操作的基本命令,可以從上面獲取到。如果想要得到更多,而且每個(gè)命令的詳細(xì)用法,可以使用上面列出的db.listCommands()查詢(xún)。

另一個(gè)比較基礎(chǔ)的是對(duì)指定數(shù)據(jù)庫(kù)的集合進(jìn)行操作、管理和監(jiān)控,可以通過(guò)查詢(xún)db.mycoll.help()獲取到:

db.mycoll.help()
 DBCollection help
     db.mycoll.find().help() - show DBCursor help
     db.mycoll.count()
     db.mycoll.dataSize()
     db.mycoll.distinct( key ) - eg. db.mycoll.distinct( 'x' )
     db.mycoll.drop() drop the collection
     db.mycoll.dropIndex(name)
     db.mycoll.dropIndexes()
     db.mycoll.ensureIndex(keypattern[,options]) - options is an object with these possible fields: name, unique, dropDups
     db.mycoll.reIndex()
     db.mycoll.find([query],[fields]) - query is an optional query filter. fields is optional set of fields to return.
                            e.g. db.mycoll.find( {x:} , {name:, x:} )
     db.mycoll.find(...).count()
     db.mycoll.find(...).limit(n)
     db.mycoll.find(...).skip(n)
     db.mycoll.find(...).sort(...)
     db.mycoll.findOne([query])
     db.mycoll.findAndModify( { update : ... , remove : bool [, query: {}, sort: {}, 'new': false] } )
     db.mycoll.getDB() get DB object associated with collection
     db.mycoll.getIndexes()
     db.mycoll.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )
     db.mycoll.mapReduce( mapFunction , reduceFunction , <optional params> )
     db.mycoll.remove(query)
     db.mycoll.renameCollection( newName , <dropTarget> ) renames the collection.
     db.mycoll.runCommand( name , <options> ) runs a db command with the given name where the first param is the collection name
     db.mycoll.save(obj)
     db.mycoll.stats()
     db.mycoll.storageSize() - includes free space allocated to this collection
     db.mycoll.totalIndexSize() - size in bytes of all the indexes
     db.mycoll.totalSize() - storage allocated for all data and indexes
     db.mycoll.update(query, object[, upsert_bool, multi_bool])
     db.mycoll.validate() - SLOW
     db.mycoll.getShardVersion() - only for use with sharding 

有關(guān)數(shù)據(jù)庫(kù)和集合管理的相關(guān)命令,是最基礎(chǔ)和最常用的,如集合查詢(xún)、索引操作等。

基本命令及實(shí)例 

下面通過(guò)實(shí)際的例子來(lái)演示一些常見(jiàn)的命令:

(一)基本命令 

1、show dbs

顯示當(dāng)前數(shù)據(jù)庫(kù)服務(wù)器上的數(shù)據(jù)庫(kù)

2、use pagedb

 切換到指定數(shù)據(jù)庫(kù)pagedb的上下文,可以在此上下文中管理pagedb數(shù)據(jù)庫(kù)以及其中的集合等

3、show collections

顯示數(shù)據(jù)庫(kù)中所有的集合(collection)

4、db.serverStatus()  

查看數(shù)據(jù)庫(kù)服務(wù)器的狀態(tài)。示例如下所示:

{
     "host" : "dev",
     "version" : "..",
     "process" : "mongod",
     "uptime" : ,
     "uptimeEstimate" : ,
     "localTime" : ISODate("--T::.Z"),
     "globalLock" : {
         "totalTime" : ,
         "lockTime" : ,
         "ratio" : .,
         "currentQueue" : {
             "total" : ,
             "readers" : ,
             "writers" : 
         },
         "activeClients" : {
             "total" : ,
             "readers" : ,
             "writers" : 
         }
     },
     "mem" : {
         "bits" : ,
         "resident" : ,
         "virtual" : ,
         "supported" : true,
         "mapped" : 
     },
     "connections" : {
         "current" : ,
         "available" : 
     },
     "extra_info" : {
         "note" : "fields vary by platform",
         "heap_usage_bytes" : ,
         "page_faults" : 
     },
     "indexCounters" : {
         "btree" : {
             "accesses" : ,
             "hits" : ,
             "misses" : ,
             "resets" : ,
             "missRatio" : .
         }
     },
     "backgroundFlushing" : {
         "flushes" : ,
         "total_ms" : ,
         "average_ms" : .,
         "last_ms" : ,
         "last_finished" : ISODate("--T::.Z")
     },
     "cursors" : {
         "totalOpen" : ,
         "clientCursors_size" : ,
         "timedOut" : 
     },
     "network" : {
         "bytesIn" : ,
         "bytesOut" : ,
         "numRequests" : 
     },
     "opcounters" : {
         "insert" : ,
         "query" : ,
         "update" : ,
         "delete" : ,
         "getmore" : ,
         "command" : 
     },
     "asserts" : {
         "regular" : ,
         "warning" : ,
         "msg" : ,
         "user" : ,
         "rollovers" : 
     },
     "writeBacksQueued" : false,
     "ok" : 
 } 

有時(shí),通過(guò)查看數(shù)據(jù)庫(kù)服務(wù)器的狀態(tài),可以判斷數(shù)據(jù)庫(kù)是否存在問(wèn)題,如果有問(wèn)題,如數(shù)據(jù)損壞,可以及時(shí)執(zhí)行修復(fù)。

5、查詢(xún)指定數(shù)據(jù)庫(kù)統(tǒng)計(jì)信息

use fragment
db.stats()

查詢(xún)結(jié)果示例如下所示:

db.stats()
 {
 &nbsp; &nbsp; &nbsp; &nbsp; "db" : "fragment",
 &nbsp; &nbsp; &nbsp; &nbsp; "collections" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "objects" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "avgObjSize" : .,
 &nbsp; &nbsp; &nbsp; &nbsp; "dataSize" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "storageSize" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "numExtents" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "indexes" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "indexSize" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "fileSize" : ,
 &nbsp; &nbsp; &nbsp; &nbsp; "ok" : 
 } 

顯示fragment數(shù)據(jù)庫(kù)的統(tǒng)計(jì)信息。

6、查詢(xún)指定數(shù)據(jù)庫(kù)包含的集合名稱(chēng)列表

db.getCollectionNames()

結(jié)果如下所示:

db.getCollectionNames()
 [
     "u",
     "baseSe",
     "bytravel",
     "daodao",
     "goeu",
     "lotour",
     "lvping",
     "mafengwo",
     "sina",
     "sohu",
     "system.indexes"
 ] 

(二)基本DDL和DML

 1、創(chuàng)建數(shù)據(jù)庫(kù)

如果你習(xí)慣了關(guān)系型數(shù)據(jù)庫(kù),你可能會(huì)尋找相關(guān)的創(chuàng)建數(shù)據(jù)庫(kù)的命令。在MongoDB中,你可以直接通過(guò)use dbname來(lái)切換到這個(gè)數(shù)據(jù)庫(kù)上下文下面,系統(tǒng)會(huì)自動(dòng)延遲創(chuàng)建該數(shù)據(jù)庫(kù),例如:

 show dbs
 admin  .GB
 local  (empty)
 pagedb .GB
 test  .GB
 use LuceneIndexDB
 switched to db LuceneIndexDB
 show dbs
 admin  .GB
 local  (empty)
 pagedb .GB
 test  .GB
 db
 LuceneIndexDB
 db.storeCollection.save({'version':'.', 'segment':'eol'})
 show dbs
 LuceneIndexDB  .GB
 admin  .GB
 local  (empty)
 pagedb .GB
 test  .GB

可見(jiàn),在use指定數(shù)據(jù)庫(kù)后,并且向指定其中的一個(gè)集合并插入數(shù)據(jù)后,數(shù)據(jù)庫(kù)和集合都被創(chuàng)建了。

2、刪除數(shù)據(jù)庫(kù)

直接使用db.dropDatabase()即可刪除數(shù)據(jù)庫(kù)。

3、創(chuàng)建集合

可以使用命令db.createCollection(name, { size : ..., capped : ..., max : ... } )創(chuàng)建集合,示例如下所示:

4、刪除集合

刪除集合,可以執(zhí)行db.mycoll.drop()。

5、插入更新記錄

直接使用集合的save方法,如下所示:

 <em>db.storeCollection.save({'version':'3.5', 'segment':'e3ol6'})</em> 

更新記錄,使用save會(huì)將原來(lái)的記錄值進(jìn)行覆蓋實(shí)現(xiàn)記錄更新。

6、查詢(xún)一條記錄

使用findOne()函數(shù),參數(shù)為查詢(xún)條件,可選,系統(tǒng)會(huì)隨機(jī)查詢(xún)獲取到滿足條件的一條記錄(如果存在查詢(xún)結(jié)果數(shù)量大于等于1)示例如下所示: 

7、查詢(xún)多條記錄 

使用find()函數(shù),參數(shù)指定查詢(xún)條件,不指定條件則查詢(xún)?nèi)坑涗洝?br />

8、刪除記錄

使用集合的remove()方法,參數(shù)指定為查詢(xún)條件,示例如下所示:

 db.storeCollection.remove({'version':'.'})
 db.storeCollection.findOne()
 null 

9、創(chuàng)建索引

可以使用集合的ensureIndex(keypattern[,options])方法,示例如下所示: 

use pagedb
switched to db pagedb
db.page.ensureIndex({'title':, 'url':-})
db.system.indexes.find()
 { "name" : "_id_", "ns" : "pagedb.page", "key" : { "_id" : }, "v" : }
 { "name" : "_id_", "ns" : "pagedb.system.users", "key" : { "_id" : }, "v" : }
 { "_id" : ObjectId("efcfcaccd"), "ns" : "pagedb.page", "key" : {"title" : , "url" : - }, "name" : "title__url_-", "v" : }

 上述,ensureIndex方法參數(shù)中,數(shù)字1表示升序,-1表示降序。

使用db.system.indexes.find()可以查詢(xún)?nèi)克饕?br />

10、查詢(xún)索引

我們?yōu)榧辖⒌乃饕?,那么可以通過(guò)集合的getIndexes()方法實(shí)現(xiàn)查詢(xún),示例如下所示: 

 db.page.getIndexes()
 [
     {
         "name" : "_id_",
         "ns" : "pagedb.page",
         "key" : {
             "_id" : 
         },
         "v" : 
     },
     {
         "_id" : ObjectId("efcfcaccd"),
         "ns" : "pagedb.page",
         "key" : {
             "title" : ,
             "url" : -
         },
         "name" : "title__url_-",
         "v" : 
     }
 ]

當(dāng)然,如果需要查詢(xún)系統(tǒng)中全部的索引,可以使用db.system.indexes.find()函數(shù)。

 11、刪除索引

 刪除索引給出了兩個(gè)方法: 

db.mycoll.dropIndex(name)
  db.mycoll.dropIndexes() 

第一個(gè)通過(guò)指定索引名稱(chēng),第二個(gè)刪除指定集合的全部索引。

 12、索引重建

可以通過(guò)集合的reIndex()方法進(jìn)行索引的重建,示例如下所示:

use fragment
db.baseSe.count()

統(tǒng)計(jì)結(jié)果,如下所示: 

 use fragment
 switched to db fragment
 db.baseSe.count()

上述統(tǒng)計(jì)了數(shù)據(jù)庫(kù)fragment的baseSe集合中記錄數(shù)。

 14、查詢(xún)并統(tǒng)計(jì)結(jié)果記錄數(shù)

 use fragment
db.baseSe.find().count()

find()可以提供查詢(xún)參數(shù),然后查詢(xún)并統(tǒng)計(jì)結(jié)果,如下所示: 

15、查詢(xún)指定數(shù)據(jù)庫(kù)的集合當(dāng)前可用的存儲(chǔ)空間

use fragment
db.baseSe.storageSize()
142564096

16、查詢(xún)指定數(shù)據(jù)庫(kù)的集合分配的存儲(chǔ)空間

db.baseSe.totalSize()
 144096000

上述查詢(xún)結(jié)果中,包括為集合(數(shù)據(jù)及其索引存儲(chǔ))分配的存儲(chǔ)空間。

(三)啟動(dòng)與終止 

1、正常啟動(dòng)

mongod --dbpath /usr/mongo/data --logfile /var/mongo.log

說(shuō)明:

指定數(shù)據(jù)存儲(chǔ)目錄和日志目錄,如果采用安全認(rèn)證模式,需要加上--auth選項(xiàng),如:

mongod --auth --dbpath /usr/mongo/data --logfile /var/mongo.log 

2、以修復(fù)模式啟動(dòng)

mongod --repair

以修復(fù)模式啟動(dòng)數(shù)據(jù)庫(kù)。

實(shí)際很可能數(shù)據(jù)庫(kù)數(shù)據(jù)損壞或數(shù)據(jù)狀態(tài)不一致,導(dǎo)致無(wú)法正常啟動(dòng)MongoDB服務(wù)器,根據(jù)啟動(dòng)信息可以看到需要進(jìn)行修復(fù)?;蛘邎?zhí)行:

mongod -f /etc/mongodb.conf --repair

3、終止服務(wù)器進(jìn)程

db.shutdownServer()

終止數(shù)據(jù)庫(kù)服務(wù)器進(jìn)程?;蛘?,可以直接kill掉mongod進(jìn)程即可。

(四)安全管理

1、以安全認(rèn)證模式啟動(dòng)

mongod --auth --dbpath /usr/mongo/data --logfile /var/mongo.log

使用--auth選項(xiàng)啟動(dòng)mongod進(jìn)程即可啟用認(rèn)證模式。

或者,也可以修改/etc/mongodb.conf,設(shè)置auth=true,重啟mongod進(jìn)程。

2、添加用戶(hù)

db.addUser("admin", ",%F23_kj~00Opoo0+\/")

添加數(shù)據(jù)庫(kù)用戶(hù),添加成功,則顯示結(jié)果如下所示:

db.auth("admin", ",%F23_kj~00Opoo0+\/")

數(shù)據(jù)庫(kù)安全認(rèn)證。認(rèn)證成功顯示結(jié)果:

 {
     "user" : "admin",
     "readOnly" : false,
     "pwd" : "debfcbabbecd"
 } 

如果是認(rèn)證用戶(hù),執(zhí)行某些命令,可以看到正確執(zhí)行結(jié)果,如下所示:

4、為數(shù)據(jù)庫(kù)寫(xiě)數(shù)據(jù)(同步到磁盤(pán))加鎖

db.runCommand({fsync:1,lock:1})

說(shuō)明:

該操作已經(jīng)對(duì)數(shù)據(jù)庫(kù)上鎖,不允許執(zhí)行寫(xiě)數(shù)據(jù)操作,一般在執(zhí)行數(shù)據(jù)庫(kù)備份時(shí)有用。執(zhí)行命令,結(jié)果示例如下:

5、查看當(dāng)前鎖狀態(tài)

db.currentOp()

說(shuō)明:

查詢(xún)結(jié)果如下所示:

6、解鎖

 use admin
db.$cmd.sys.unlock.findOne()

說(shuō)明:

執(zhí)行解鎖,結(jié)果如下所示:

db.currentOp()

狀態(tài)信息如下:

(五)數(shù)據(jù)備份、恢復(fù)與遷移管理 

1、備份全部數(shù)據(jù)庫(kù)

mkdir testbak
cd testbak
mongodump

說(shuō)明:默認(rèn)備份目錄及數(shù)據(jù)文件格式為./dump/[databasename]/[collectionname].bson

2、備份指定數(shù)據(jù)庫(kù)

mongodump -d pagedb

說(shuō)明:備份數(shù)據(jù)庫(kù)pagedb中的數(shù)據(jù)。

3、備份一個(gè)數(shù)據(jù)庫(kù)中的某個(gè)集合

mongodump -d pagedb -c page

說(shuō)明:備份數(shù)據(jù)庫(kù)pagedb的page集合。

4、恢復(fù)全部數(shù)據(jù)庫(kù)

cd testbak
mongorestore --drop

說(shuō)明:將備份的所有數(shù)據(jù)庫(kù)恢復(fù)到數(shù)據(jù)庫(kù),--drop指定恢復(fù)數(shù)據(jù)之前刪除原來(lái)數(shù)據(jù)庫(kù)數(shù)據(jù),否則會(huì)造成回復(fù)后的數(shù)據(jù)中數(shù)據(jù)重復(fù)。

5、恢復(fù)某個(gè)數(shù)據(jù)庫(kù)的數(shù)據(jù)

cd testbak
mongorestore -d pagedb --drop

說(shuō)明:將備份的pagedb的數(shù)據(jù)恢復(fù)到數(shù)據(jù)庫(kù)。

6、恢復(fù)某個(gè)數(shù)據(jù)庫(kù)的某個(gè)集合的數(shù)據(jù)

cd testbak
mongorestore -d pagedb -c page --drop

說(shuō)明:將備份的pagedb的的page集合的數(shù)據(jù)恢復(fù)到數(shù)據(jù)庫(kù)。

7、向MongoDB導(dǎo)入數(shù)據(jù)

mongoimport -d pagedb -c page --type csv --headerline --drop < csvORtsvFile.csv

說(shuō)明:將文件csvORtsvFile.csv的數(shù)據(jù)導(dǎo)入到pagedb數(shù)據(jù)庫(kù)的page集合中,使用cvs或tsv文件的列名作為集合的列名。需要注意的是,使用--headerline選項(xiàng)時(shí),只支持csv和tsv文件。

--type支持的類(lèi)型有三個(gè):csv、tsv、json
其他各個(gè)選項(xiàng)的使用,可以查看幫助:

mongoexport -d pagedb -c page -q {} -f _id,title,url,spiderName,pubDate --csv > pages.csv

說(shuō)明:將pagedb數(shù)據(jù)庫(kù)中page集合的數(shù)據(jù)導(dǎo)出到pages.csv文件,其中各選項(xiàng)含義:

-f 指定cvs列名為_(kāi)id,title,url,spiderName,pubDate
-q 指定查詢(xún)條件

其他各個(gè)選項(xiàng)的使用,可以查看幫助:

如果上面的選項(xiàng)-q指定一個(gè)查詢(xún)條件,需要使用單引號(hào)括起來(lái),如下所示:

否則,就會(huì)出現(xiàn)下面的錯(cuò)誤:

1、基于mongo實(shí)現(xiàn)遠(yuǎn)程連接

當(dāng)你已經(jīng)連接到一個(gè)遠(yuǎn)程的MongoDB數(shù)據(jù)庫(kù)服務(wù)器(例如,通過(guò)mongo連接到192.168.0.184),現(xiàn)在想要在這個(gè)會(huì)話中連接另一個(gè)遠(yuǎn)程的數(shù)據(jù)庫(kù)服務(wù)器(192.168.0.197),可以執(zhí)行如下命令:

如果啟用了安全認(rèn)證模式,可以在獲取數(shù)據(jù)庫(kù)連接實(shí)例時(shí),指定認(rèn)證賬號(hào).

好了,本文給大家介紹的MongoDB管理命令到此結(jié)束,希望本文分享能夠給大家?guī)?lái)幫助。

相關(guān)文章

  • MongoDB實(shí)現(xiàn)自動(dòng)備份的全過(guò)程記錄

    MongoDB實(shí)現(xiàn)自動(dòng)備份的全過(guò)程記錄

    這篇文章主要給大家介紹了關(guān)于MongoDB實(shí)現(xiàn)自動(dòng)備份的全過(guò)程,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用MongoDB具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • 基于?MongoTemplate實(shí)現(xiàn)MongoDB的復(fù)雜查詢(xún)功能

    基于?MongoTemplate實(shí)現(xiàn)MongoDB的復(fù)雜查詢(xún)功能

    本文介紹了如何使用MongoTemplate進(jìn)行復(fù)雜的MongoDB查詢(xún),展示了如何進(jìn)行分頁(yè)和排序查詢(xún),通過(guò)示例代碼,展示了如何處理不同類(lèi)型的查詢(xún),如單條件查詢(xún)、模糊查詢(xún)、組合條件查詢(xún)以及分頁(yè)排序查詢(xún),感興趣的朋友跟隨小編一起看看吧
    2024-12-12
  • MongoDB副本集丟失數(shù)據(jù)的測(cè)試實(shí)例教程

    MongoDB副本集丟失數(shù)據(jù)的測(cè)試實(shí)例教程

    這篇文章主要給大家介紹了關(guān)于MongoDB副本集丟失數(shù)據(jù)的測(cè)試的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用MongoDB具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • Windows下把MongoDB安裝為系統(tǒng)服務(wù)的方法

    Windows下把MongoDB安裝為系統(tǒng)服務(wù)的方法

    這篇文章主要介紹了Windows下把MongoDB安裝為系統(tǒng)服務(wù)的方法,本文詳細(xì)介紹了將mongoDB安裝為WinXP下系統(tǒng)服務(wù)的過(guò)程,需要的朋友可以參考下
    2014-10-10
  • 如何為MongoDB添加分片副本集

    如何為MongoDB添加分片副本集

    這篇文章主要介紹了如何為MongoDB添加分片副本集,幫助大家更好的理解和學(xué)習(xí)使用MongoDB數(shù)據(jù)庫(kù),感興趣的朋友可以了解下
    2021-03-03
  • mongodb與mysql命令詳細(xì)對(duì)比

    mongodb與mysql命令詳細(xì)對(duì)比

    MongoDB的好處挺多的,比如多列索引,查詢(xún)時(shí)可以用一些統(tǒng)計(jì)函數(shù),支持多條件查詢(xún),但是目前多表查詢(xún)是不支持的,可以想辦法通過(guò)數(shù)據(jù)冗余來(lái)解決多表查詢(xún)的問(wèn)題
    2013-08-08
  • MongoDB數(shù)據(jù)庫(kù)forEach循環(huán)遍歷用法

    MongoDB數(shù)據(jù)庫(kù)forEach循環(huán)遍歷用法

    這篇文章主要介紹了MongoDB數(shù)據(jù)庫(kù)forEach循環(huán)遍歷用法,需要的朋友可以參考下
    2014-07-07
  • Mongodb 刪除添加分片與非分片表維護(hù)

    Mongodb 刪除添加分片與非分片表維護(hù)

    MongoDB 是一個(gè)介于關(guān)系數(shù)據(jù)庫(kù)和非關(guān)系數(shù)據(jù)庫(kù)之間的產(chǎn)品,是非關(guān)系數(shù)據(jù)庫(kù)當(dāng)中功能最豐富,最像關(guān)系數(shù)據(jù)庫(kù)的。通過(guò)本文給大家介紹Mongodb 刪除添加分片與非分片表維護(hù)的相關(guān)知識(shí),對(duì)此文感興趣的朋友一起學(xué)習(xí)吧
    2016-01-01
  • MongoDB Windows安裝服務(wù)方法與注意事項(xiàng)

    MongoDB Windows安裝服務(wù)方法與注意事項(xiàng)

    這篇文章主要介紹了MongoDB Windows安裝服務(wù)方法與注意事項(xiàng)的相關(guān)資料,MongoDB作為一個(gè)基于分布式文件存儲(chǔ)的數(shù)據(jù)庫(kù),近兩年大受追捧。數(shù)據(jù)靈活的存取方式和高效的處理使得它廣泛用于互聯(lián)網(wǎng)應(yīng)用,需要的朋友可以參考下
    2016-12-12
  • MongoDB利用oplog恢復(fù)數(shù)據(jù)的方法

    MongoDB利用oplog恢復(fù)數(shù)據(jù)的方法

    這篇文章主要介紹了MongoDB利用oplog恢復(fù)數(shù)據(jù)的方法,當(dāng)我們對(duì)數(shù)據(jù)出現(xiàn)誤操作的時(shí)候,可以利用oplog恢復(fù)數(shù)據(jù),下文操作過(guò)程需要的小伙伴可以參考一下
    2022-04-04

最新評(píng)論

金塔县| 高碑店市| 东港市| 南木林县| 比如县| 繁峙县| 江城| 冷水江市| 邹城市| 高阳县| 美姑县| 黑河市| 三河市| 龙山县| 天气| 富阳市| 封丘县| 红原县| 荣昌县| 中超| 高淳县| 张家港市| 新田县| 明星| 红安县| 西和县| 平安县| 抚州市| 玛纳斯县| 朔州市| 福安市| 股票| 周至县| 马尔康县| 察哈| 香港 | 万山特区| 临江市| 武穴市| 深水埗区| 新宁县|