mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-09 07:09:57 +03:00
Add a mongoexp.sh script.
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#! /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
|
||||
@@ -0,0 +1,9 @@
|
||||
const { IterateCollections } = require("./util");
|
||||
|
||||
IterateCollections((data) => {
|
||||
for (const d of data) {
|
||||
delete d._id;
|
||||
}
|
||||
|
||||
return data;
|
||||
});
|
||||
Reference in New Issue
Block a user