Files
sailing-analytics/doc/MONGO_DATA_IMPORT_EXPORT
T

36 lines
1.3 KiB
Plaintext

Cloning wind data from one MongoDB instance to another
------------------------------------------------------
10200: MongoDB "dev" instance
10201: MongoDB "test" instance
10202: MontoDB "prod" instance
connect to the mongo shell:
e.g. /opt/mongodb/bin/mongo --port 10202
typical commands:
show dbs displays all the databases on the server you are connected to
use db_name switches to db_name on the same server
show collections displays a list of all the collections in the current database
First, export the WIND_TRACKS collection from one database. For example...
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS > /tmp/wind-tracks-dev.json
or with an additional query parameter if only want to export the wind of a specific race
/opt/mongodb/bin/mongoexport --port 10202 -d winddb -c WIND_TRACKS -q "{ 'EVENT_NAME': /Arenal Training Camps Regatta 2012/, 'RACE_NAME': /Laser/}" > /tmp/wind-tracks-dev.json
To import the resulting JSON file into the DB instance call:
/opt/mongodb/bin/mongoimport --port 10201 -d winddb -c WIND_TRACKS /tmp/wind-tracks-dev.json
Name change of the TracTrac Account
-----------------------------------
Update the wind track data
mongo update command:
db.WIND_TRACKS.update({EVENT_NAME: "Sailing Team Germany"}, { $set: {EVENT_NAME: "Academy Tracking 2011"}}, true, true)