-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (21 loc) · 776 Bytes
/
main.py
File metadata and controls
38 lines (21 loc) · 776 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
from pymongo import MongoClient
from Department import Department
cluster = input("Input your connection link: ") or "mongodb+srv://rboixo:Carm3n1ta@atlascluster.wxir5tb.mongodb.net/?retryWrites=true&w=majority"
database = input("Input the name of your database: ") or "CECS323Database"
client = MongoClient(cluster)
db = client[database]
Dp = Department(db)
go = True
while go:
action = int(input("What do you want to do: \n 1:Add department \n 2:Delete department \n3: Quit"))
if action == 1:
Dp.add_department()
elif action==2:
Dp.delete_department()
else:
go = False
departments = db.departments.find()
# Print the departments.
for department in departments:
print(department)
# Get all of the departments in the collection.