opt-cc/api/apib/mongo-test-data/tets-data-extract.sh

21 lines
565 B
Bash
Raw Normal View History

2018-03-20 13:22:55 +01:00
#!/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