Commit 103754345878c35b64e889dc0c0c107d6ee62fe3
pymongo updated methods to write and initiate a db
| | | | 31 | | 31 | |
---|
32 | @app.route('/fetch', methods=['GET']) | 32 | @app.route('/fetch', methods=['GET']) |
---|
33 | def fetch(): | 33 | def fetch(): |
---|
34 | connection = pymongo.Connection() | | connection = pymongo.Connection() |
---|
| | 34 | connection = pymongo.MongoClient('localhost',27017) | 35 | db = connection['mural'] | 35 | db = connection['mural'] |
---|
36 | collection = db['data'] | 36 | collection = db['data'] |
---|
37 | ret = {} | 37 | ret = {} |
---|
… | | … | |
---|
58 | | 58 | |
---|
59 | @app.route('/search', methods=['GET']) | 59 | @app.route('/search', methods=['GET']) |
---|
60 | def search(): | 60 | def search(): |
---|
61 | connection = pymongo.Connection() | | connection = pymongo.Connection() |
---|
| | 61 | connection = pymongo.MongoClient('localhost',27017) | 62 | db = connection['mural'] | 62 | db = connection['mural'] |
---|
63 | collection = db['data'] | 63 | collection = db['data'] |
---|
64 | y = 0 | 64 | y = 0 |
---|
… | | … | |
---|
97 | | 97 | |
---|
98 | @app.route('/submit', methods=['POST']) | 98 | @app.route('/submit', methods=['POST']) |
---|
99 | def submit(): | 99 | def submit(): |
---|
100 | c = pymongo.Connection() | | c = pymongo.Connection() |
---|
| | 100 | c = pymongo.MongoClient('localhost',27017) | 101 | db = c['mural'] | 101 | db = c['mural'] |
---|
102 | coll = db['data'] | 102 | coll = db['data'] |
---|
103 | requestData = json.loads(request.form['data']) | 103 | requestData = json.loads(request.form['data']) |
---|