S
S
Sergey2014-11-20 20:09:04
MongoDB
Sergey, 2014-11-20 20:09:04

How to add collections from backup to existing ones in mongo?

In general, there is a database with a collection of articles, documents in it.
There is a backup of another articles collection.
How to add documents from a backup to existing ones?
How to make the backup overwrite other documents in the collection that already have such a title? If this cannot be specified when restoring from a backup, then I will write a script or do it manually, but suddenly you can specify this option right away - I will be grateful to her.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
YV, 2014-11-21
@targetjump

mongorestore will not help
You need to write a script.

L
lega, 2014-11-21
@lega

Not a very good option, but you can try to do this:
1) Make mongodump the active database
2) Restore the backup to "empty database"
3) Make a unique index by title
4) Make mongorestore the active database to this database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question