在分段和本地数据库之间复制数据
Mongo 支持数据库到数据库的复制,如果要在临时数据库上拥有要复制到本地开发实例的大型数据库,这将非常有用。
// run mongod so we can create a staging database
// note that this is a separate instance from the meteor mongo and minimongo instances
mongod
// import the json data into a staging database
// jsonArray is a useful command, particularly if you're migrating from SQL
mongoimport -d staging -c assets < data.json --jsonArray
// navigate to your application
cd myappdir
// run meteor and initiate it's database
meteor
// connect to the meteor mongodb
meteor mongo --port 3002
// copy collections from staging database into meteor database
db.copyDatabase('staging', 'meteor', 'localhost');