Listen only to additions to a cloud firestore collection?

后端 未结 4 1539
甜味超标
甜味超标 2021-01-04 00:44

I\'ve noticed, when I try to use a realtime listener on a Collection in firestore, each time a new Document is added to the collection, the logic will be rerun, and I will d

4条回答
  •  没有蜡笔的小新
    2021-01-04 00:51

    You can get the new document that caused this callback

    for change in changes:
        if change.type.name == 'ADDED':
            print(f'New document: {change.document.id}')
    

提交回复
热议问题