So I have my local setup of nestjs with mongodb. And I have this issue to sync the local database with live one everytime. The method I am using write now is as follows
mongodump -d <db> -o <folder>
This folder is inside my git directory. This is then pushed to the live directory.
In the live server I use
mongorestore -d <db> <folder-to-git>
Although this works for me now during the development phase it stills consumes a bit of time.
P.S. I want a solution without opening ports. :D
Furthermore I have added them to the package.json file as follows -
"dump": "mongodump -d <db> -o src/dbdump/",
"restore": "mongorestore -d <db> src/dbdump/<db>"
Top comments (0)