-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDb.py
More file actions
22 lines (19 loc) · 705 Bytes
/
Db.py
File metadata and controls
22 lines (19 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pymongo
myClient = pymongo.MongoClient("mongodb://localhost:27017")
mydb = myClient["mydatabase"]
mycol = mydb["UserKarma"]
pomodoroCol = mydb["Pomodoro"]
for document in mycol.find():
print(document)
if not mycol.find():
karmaList = [
{"Name": "Adil", "Opdutter": 0, "Neddutter": 0},
{"Name": "Chrille", "Opdutter": 0, "Neddutter": 0},
{"Name": "Hjorth", "Opdutter": 0, "Neddutter": 0},
{"Name": "Martin", "Opdutter": 0, "Neddutter": 0},
{"Name": "Magnus", "Opdutter": 0, "Neddutter": 0},
{"Name": "Simon", "Opdutter": 0, "Neddutter": 0},
{"Name": "Sten", "Opdutter": 0, "Neddutter": 0}
]
x = mycol.insert_many(karmaList)
print(x.inserted_ids)