Files
zkldi_Tachi/database-seeds/scripts/mongoexp.sh
T
2021-11-26 15:31:09 +00:00

17 lines
401 B
Bash
Executable File

#! /bin/bash
# Exports data from a mongodb instance back to the collections
# folder.
# Useful for backporting updates, or something.
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: mongoexp.sh <collection> <dbname>";
exit
fi
mongoexport -d "$2" -c "$1" --jsonArray > ../collections/"$1".json
node remove-_id.js
node deterministic-collection-sort.js