I'm trying to listen to a firebase collection for a document creation.
The firebase documentation lays it out like this:
# Create a callback on_snapshot function to capture changes
def on_snapshot(col_snapshot, changes, read_time):
print(u'Callback received query snapshot.')
print(u'Current cities in California:')
for doc in col_snapshot:
print(u'{}'.format(doc.id))
col_query = db.collection(u'cities').where(u'state', u'==', u'CA')
# Watch the collection query
query_watch = col_query.on_snapshot(on_snapshot)
Instead of u'state' inside of the where(), is there some way to reference the document title? (The title is not present within the document)
I've tried using u'__name__'
but get the error:
RuntimeError: Error 3: a filter on __name__ must be a document resource name