added connectivity content

This commit is contained in:
K 2024-10-21 23:14:03 +05:30
parent 1c02a1a0f7
commit bbc5a7e385
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,24 @@
sudo python3 -m pip install pymongo
###Open mongo
use test1
db.createCollection("emp")
###Open Python
from pymongo import MongoClient
client=MongoClient("mongodb://127.0.0.1:27017")
database=client.test1
collection=database.emp
collection.insert_one({"name":"smartphone","quantity":"10","price":"50000"})
print("inserted")
client.close()
## check output in mongo
Dr.S.K.Wagh (MES's Wadia COE,Pune)

View File

@ -0,0 +1,21 @@
sudo python3 -m pip install pymongo
###Open mongo
use test1
db.createCollection("emp")
###Open Python
from pymongo import MongoClient
client=MongoClient("mongodb://127.0.0.1:27017")
database=client.test1
collection=database.emp
collection.insert_one({"name":"smartphone","quantity":"10","price":"50000"})
print("inserted")
client.close()
## check output in mongo