#Autor: Bregy Malpartida Ramos
#Lima, Perú 08/04/2016
from pymongo import MongoClient
def downloadData(self, database, collection):
vectF = []
client = MongoClient(server)
dataB = self.client[database]
coll = dataB[collection].find()
vect =[]
for i in coll:
vect.append(i)
for j in range(0,len(vect)):
vectF.append(vect[j]['sensor{0}'.format(j+1)])
return vectF
A simple function for find data of a collection from database using MongoDB and pymongo.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.