i had to update a collection on my local machine and want to upload this to a docker instance, here is my procedure
$ #backup local database
$ mongodump --collection styles --db ccc-mongo
$ tar -zcvf dump.tar.gz dump
$ scp dump.tar.gz me@remote:/home/me
$ ssh me@remote
me@remote: ~ $ docker exec -i mongo-dev sh -c "cd /tmp && tar xzf - && mongorestore --collection styles --db ccc-mongo" < dump.tar.gz
this gives me an error
connected to: 127.0.0.1
Fri Dec 18 16:05:26.768 ERROR: ERROR: root directory must be a dump of a single database
Fri Dec 18 16:05:26.768 ERROR: when specifying a db name with --db
Import BSON files into MongoDB.
i just need to restore one collection without removing the other data, any advice much appreciated
this worked for me
need to make sure in the dump to just include the collection i want to restore only
I figured out how to do it
Here are the instructions
Copy dump folder to server
SSH into server
Copy from root of server to inside docker container
Go into mongodb docker container
check if copied folder exists
ls
(you should see dump_folder, if you named it the same folder as in this example)use mongorestore