Skip to content

Instantly share code, notes, and snippets.

@frankyaorenjie
Created July 25, 2018 13:34
Show Gist options
  • Save frankyaorenjie/96d55923fdd43f5f59710c9ea3c96b09 to your computer and use it in GitHub Desktop.
Save frankyaorenjie/96d55923fdd43f5f59710c9ea3c96b09 to your computer and use it in GitHub Desktop.
[mongodb snippets] #mongodb
# source database: rec_prod, collection: rec_history
# dest database: recognition, collection: recognition_history
mongodump --host rec-shard-0/rec-shard-00-00-cudev.mongodb.net:27017,rec-shard-00-01-cudev.mongodb.net:27017,rec-shard-00-02-cudev.mongodb.net:27017 --ssl --username renjie --password <PASSWORD> --authenticationDatabase admin --db rec_prod -c rec_history -o ./dump/ -q '{timestamp: {$gte: ISODate("2017-08-01T00:00:00.000Z"), $lt: ISODate("2017-09-01T00:00:00.000Z")}}'
mongorestore --host visenze/mongodb-0.data.visenze.com:27017,mongodb-1.data.visenze.com:27017,mongodb-2.data.visenze.com:27017 --username data_api_rw --password <PASSWORD> --authenticationDatabase annotation -d recognition -c recognition_history ./dump/rec_prod/rec_history.bson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment