-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavail-ingredients.py
executable file
·62 lines (43 loc) · 1.57 KB
/
avail-ingredients.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from pymongo import MongoClient
#import pymongo
import json
client = MongoClient("mongodb://caren:[email protected]:27017,cluster0-shard-00-01-yeacn.mongodb.net:27017,cluster0-shard-00-02-yeacn.mongodb.net:27017/admin?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin")
db = client['avail-ingredients']
pantry = db['pantry']
recommended = db['recommended']
currentrec= db['currentrec']
searched = db['searched']
currentingredients = db['currentingredients']
currentingredients.delete_many({})
currentinstructions = db['currentinstructions']
currentinstructions.delete_many({})
currentstep = db['currentstep']
with open('pantry.json') as data_file:
data = json.load(data_file)
pantry.insert(data)
#pantry.update(data, {'upsert': False})
#pantry.ingredients.delete_many({})
#pantry.replaceOne({}, data, False)
pantry.delete_many({})
#pantry.insert({"name":"cherry","quantity":3})
#pantry.insert({"name":"apple","quantity":4})
#pantry.insert({"name":"peach","quantity":1})
with open('options.json') as data_file:
data = json.load(data_file)
recommended.delete_many({})
with open('searched.json') as data_file:
data = json.load(data_file)
searched.delete_many({})
# with open('pantry.json') as data_file:
# currentingredients.delete_many({})
# with open('pantry.json') as data_file:
# currentinstructions.delete_many({})
#for doc in pantry.find():
# print doc["name"]
#pantry.remove({"name":"cherry"})
#pantry.remove()
#print doc
#print doc["ingredients"]
#for
#print i["name"]
#break