Reputation: 103
I know there is some limitation on how to query documents in a subcollection from the root collection, but when you have a reference to the sub collection it shouldnt be a problem, should it (???)
The structure looks like this:
SensorName (Collection) -> MyDocument (Document) -> SensorHistory (SubCollection)
doc_ref = db.collection('sensorData').document('Engineroom').collection('History').order_by("timestamp").where(u"SensorType", u"==", 'temp')
result = doc_ref.stream().to_dict()
print(result)
This is the error i am getting
result = doc_ref.stream().to_dict() AttributeError: 'generator' object has no attribute 'to_dict'
Do I really need to put my History collection in the root to able to query it ?
Or is it me that have made a mistake in my code ? :)
Thanks for any help :)
Upvotes: 0
Views: 482