国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

mongodb 怎么合并多個 database
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-06-21 10:11:34
0
1
1141

現(xiàn)在一個實(shí)例里有 DBA, DBB, DBC, NewDB,如何把ABC導(dǎo)入到NewDB?
結(jié)構(gòu)是一樣的,試過For InsertInsertMany,但是數(shù)據(jù)有接近500W,插了沒幾條就不工作了。而且效率太低。
請問有什么高效的辦法嗎?

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級講師

全部回復(fù)(1)
洪濤

如果是復(fù)制集的話倒是有辦法,不是十分直觀不過我們有renameCollection Command:
注意:務(wù)必讀完上面的鏈接再動手。

{ renameCollection: "<source_namespace>", to: "<target_namespace>", dropTarget: <true|false> }
Field Type Description
renameCollection string The namespace of the collection to rename. The namespace is a combination of the database name and the name of the collection.
to string The new namespace of the collection. If the new namespace specifies a different database, the renameCollection command copies the collection to the new database and drops the source collection.
dropTarget boolean Optional. If true, mongod will drop the target of renameCollection prior to renaming the collection. The default value is false.

Example:

use admin
db.runCommand( { renameCollection: "DBA.xxx", to: "NewDB.xxx" } )
db.runCommand( { renameCollection: "DBA.yyy", to: "NewDB.yyy" } )
...
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板