Last active
August 4, 2021 13:53
-
-
Save kzzzr/88757434a13bb7e650735ff0d86360f9 to your computer and use it in GitHub Desktop.
Export and analyse MongoDB schema to relational view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prepare list of databases | |
declare -a DATABASES=( | |
"documents" | |
"communication" | |
"flights" | |
) | |
# loop through databases and generate schemas to yaml files | |
for db in "${DATABASES[@]}" | |
do | |
mongodrdl \ | |
--host=<host_address> \ | |
--port=<port> \ | |
--db=$db \ | |
--username=<username> \ | |
--password=<password> \ | |
--out=./$db.yml \ | |
--sampleSize=10000 # choose number of documents to be sampled | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment