Reputation: 357
I have a MongoDB Atlas cloud database,
and I want to "sync" to a local server instance with mongod
server running.
I have written an automated backup script that backs up a website, which then also does a mongodump
to create an archive file from the (local) MongoDB, which then all gets dumped to an AWS bucket.
It's been working great, but I just realized that it's getting the local disk's mongo data, and not the "live" data on the Mongo Atlas cloud.
Is there a way mongodump
can dump the MongoDB Atlas stuff to the local disk?
I hope there is an easier way than to "find" all on individual Atlas collections in my database, and "update" to the local disk.
Upvotes: 0
Views: 596
Reputation: 357
I was successfully able to get a dump from Atlas to my local server using mongodump
.
mongodump --forceTableScan --url="mongodb+srv://<username>:<password>@yourmongoserver.something.mongodb.net/<database name>"
Note this failed until I included the --forceTableScan
, which then after was seemingly successful.
Upvotes: 1