Does mongodb copydatabase function overwrite the destination db? -


i use way:

db.copydatabase('src','dest', 'server:27017') 

does documents in dest remove or replaced if have same id ?

no, not erase existing database. rather, try merge two. errors occur when both databases have documents same unique keys.

> db.copydatabase('sourcedb', 'destdb', 'localhost:27017') {     "errmsg" : "exception: e11000 duplicate key error index: destdb.coll1.$_id_  dup key: { : objectid('52ebcb2ab33a160d3f1fb6fe') }",     "code" : 11000,     "ok" : 0 } 

full code of experiment.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -