-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (28 loc) · 786 Bytes
/
Copy pathmain.py
File metadata and controls
41 lines (28 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
URI = ""
from pymongo import MongoClient
client = MongoClient(URI)
# print(client.admin.command('ping'))
db = client['students']
coll = db['cdshpyt']
# Create__________
# coll.insert_one({
# 'name':'Rakesh',
# 'roll':6737843267,
# 'phone':6296386131,
# })
# print(coll.insert_one({
# 'name':'Rimi',
# 'roll':6737848537,
# 'phone':8926731111,
# }))
# Read_______
# all_data = coll.find()
# [print(data) for data in all_data]
# all_data = coll.find_one({'name':'Rakesh'})
# print(all_data)
# Update__________
# coll.update_one({'name':'Rakesh'},{'$set':{'name':'Rakesh Kundu'}})
# coll.update_one({'name':'Rimi'},{'$set':{'name':'Rimi Bairi'}})
# Delete_____________
# coll.delete_one({'name':'Rakesh Kundu'})
# coll.delete_one({'name':'Rimi Bairi'})