Skip to content

Instantly share code, notes, and snippets.

View ncocana's full-sized avatar

Noa Cocaña Macías ncocana

View GitHub Profile
@ncocana
ncocana / exportJsonMongo.py
Created January 9, 2023 19:49
Script in python to export all collections from a database in MongoDB.
import os
# Exports JSON files of each collection in the database in MongoDB.
def exportJsonMongo():
# Fill the variables with the data from your Mongo Cluster.
atlas_uri = "mongodb+srv://nameCluster.codeCluster.mongodb.net/database"
username = "username"
password = "password"
directory_to_export = "./folder"