Created
June 1, 2024 03:18
-
-
Save syedjaferk/52910f0e892cb8ca387776f6293b562e to your computer and use it in GitHub Desktop.
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
from pymongo.mongo_client import MongoClient | |
from faker import Faker | |
fake = Faker() | |
# Mongo Db Connection | |
MONGO_CONN_STR = "mongodb://localhost:27017" | |
mongo_client = MongoClient(MONGO_CONN_STR) | |
database = mongo_client['test'] | |
collection = database["todos"] | |
for itr in range(1, 1000000): | |
data = { | |
"id": str(itr), | |
"name": fake.name(), | |
"description": fake.text(100) | |
} | |
collection.insert_one(data) | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment