mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
40 lines
1.7 KiB
Plaintext
40 lines
1.7 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 "{ 'REGATTA_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({REGATTA_NAME: "Sailing Team Germany"}, { $set: {REGATTA_NAME: "Academy Tracking 2011"}}, true, true)
|
|
|
|
or something along the lines of:
|
|
|
|
db.eval(function() { db.RACE_LOGS.find({"RACE_LOG_IDENTIFIER.a": /ESS 2013 Porto*/, "RACE_LOG_EVENT.RACE_LOG_EVENT_CLASS" : "RaceLogWindFixEvent"}).forEach(function(e) { if (e.RACE_LOG_EVENT.WIND.DEGREE_BEARING < 0) { e.RACE_LOG_EVENT.WIND.DEGREE_BEARING = e.RACE_LOG_EVENT.WIND.DEGREE_BEARING+360.; db.RACE_LOGS.save(e); }}); })
|