Created
November 28, 2016 19:04
-
-
Save ari-vedant-jain/44b9333ee560cd6774a28799ea877830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
from pymongo import MongoClient | |
connection = MongoClient('localhost', 27017) | |
db = connection.omh | |
data = db.results | |
resultList = data.find() | |
#print collections in the database | |
db.collection_names() | |
#cursor = db['omh'].find({"header.schema_id.name": "blood-pressure"}) | |
#load from collection 'omh' to a variable docs | |
docs = db['omh'].find() | |
print() | |
print('+-+-+-+-+-+-+-+-+-+-+-+-+-+') | |
for record in docs: | |
# print out the document | |
# print id, timestamp, value | |
print(record['header']['schema_id']['name'], record['body']['effective_time_frame']['date_time'], record['body']['systolic_blood_pressure']['value']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment