mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Script to backup the mongo db
This commit is contained in:
parent
da3e810a32
commit
86b127378b
1 changed files with 10 additions and 0 deletions
10
export-collections.bash
Normal file
10
export-collections.bash
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DB_NAME="evaluetonsavoir"
|
||||||
|
OUTPUT_DIR="/data/db"
|
||||||
|
|
||||||
|
collections=$(mongosh $DB_NAME --quiet --eval "db.getCollectionNames().join(' ')")
|
||||||
|
|
||||||
|
for collection in $collections; do
|
||||||
|
mongoexport --db=$DB_NAME --collection=$collection --out=$OUTPUT_DIR/$collection.json --jsonArray
|
||||||
|
done
|
||||||
Loading…
Reference in a new issue