Add test-data export/import script

pull/32/head
Florian Hartwich 2018-03-20 13:22:55 +01:00
parent 7b58dac768
commit 96bbdb53ef
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# execute script in its location folder
cd $(dirname $0)
DB_NAME="cc-test"
# array of available collection names
col=(app_user awarding campaign decoration logBudget logFlag logKill logPoints logRespawn logRevive logTransport player promotion rank squad user war)
for i in "${col[@]}"
do
if [ "$1" == "import" ]
then
mongoimport --db ${DB_NAME} --collection $i --drop --file ${i}.json
else
echo -e "$(date "+%Y-%m-%dT%T.%3N%z")\tTable: ${i}"
mongoexport --db ${DB_NAME} --collection $i --out ${i}.json;
fi
done