Answers for "mongodb in python"

1

mongo db python

import pymongo

myclient = pymongo.MongoClient("mongodb://localhost:27017/")

mydb = myclient["mypython"]
Posted by: Guest on July-03-2021
0

mongodb in python

# install the pymongo module through pip or some other package manager

from pymongo import MongoClient

client = MongoClient("<mongodb uri>") 
db = client.example_database # you can also do 'client["example_database"]'
collection = db.example_collection

for i in collection.find(): # returns a list of documents in the collection
	print(i) # print collection document
Posted by: Guest on July-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language