Skip to content

Instantly share code, notes, and snippets.

@syedjaferk
Created June 1, 2024 03:18
Show Gist options
  • Save syedjaferk/52910f0e892cb8ca387776f6293b562e to your computer and use it in GitHub Desktop.
Save syedjaferk/52910f0e892cb8ca387776f6293b562e to your computer and use it in GitHub Desktop.
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