Add test-data export/import script
parent
7b58dac768
commit
96bbdb53ef
|
@ -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
|
Loading…
Reference in New Issue