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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -