Skip to content

Instantly share code, notes, and snippets.

Created July 10, 2016 17:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import pymongo
from datetime import datetime, timedelta
from repository_base import Repository
class MongoDBRepository(Repository):
def get_data(self,topic_name, numdays):
db=mongoClient.SensorData - timedelta(numdays)
cursor = db.home_data.find({"topic":topic_name,"time":{"$gte":yesterday}}).sort("time",pymongo.ASCENDING)
values = []
labels = []
for r in cursor:
return labels, values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment