ppyordanov / Dynamic-Noise-and-Pollution-Map

A dynamically generated University of Glasgow noise and pollution campus map via the innovative Smart Citizen Kit developed in Barcelona, Spain by FabLab.
0 stars 0 forks source link

Database Test Data #69

Closed ppyordanov closed 9 years ago

ppyordanov commented 9 years ago

Database test data needs to be exported or replicated from the remote server to localhost to be used for development purposes.

ppyordanov commented 9 years ago

Mongo DB has a very convenient set of commands with multiple flags that facilitate database and even collection export to a json file that can then be easily imported. Here is how the base command looks like:

mongoexport -d /DATABASE/ -c /COLLECTION/ -o /OUTPUT_FILE/ mongoimport -d /DATABASE/ -c /COLLECTION/ -o /OUTPUT_FILE/

So I exported the relevant collections from the server's database and imported them into my local setup's database:

mongoexport -d ugmap -c Routes -o ugmap_routes.json 
mongoexport -d ugmap -c DataReadings -o ugmap_data_readings.json

Note: had some issues with data reimport: in order to resolve the conflict I used the -jsonArray flag to make sure that the data will be imported successfully (the error was due to an overflow in the timestamp field)

mongoimport -d ugmap -c Routes --file ugmap_routes.json
mongoimport -d ugmap -c DataReadings --file ugmap_data_readings.json

I have also created a backup directory on the repository where I have saved the json files and will be backing up the data again when participants have been recruited and start intensive testing.

Here is the location where backups will be uploaded: