added connectivity content
This commit is contained in:
parent
1c02a1a0f7
commit
bbc5a7e385
24
Practical/Assignment-A9+B4+C1 (Mini Project)/mongo_Connectivity-1.txt
Executable file
24
Practical/Assignment-A9+B4+C1 (Mini Project)/mongo_Connectivity-1.txt
Executable 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)
|
21
Practical/Assignment-A9+B4+C1 (Mini Project)/mongo_Connectivity.txt
Executable file
21
Practical/Assignment-A9+B4+C1 (Mini Project)/mongo_Connectivity.txt
Executable 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
|
BIN
Practical/Assignment-A9+B4+C1 (Mini Project)/mysql_Python connectivity.pdf
Executable file
BIN
Practical/Assignment-A9+B4+C1 (Mini Project)/mysql_Python connectivity.pdf
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user