[Python] Firestore: Correct way to refer document ID in query

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    import firebase_admin
    from firebase_admin import credentials, firestore
    import google.auth


    def reset(self, request_data):
    db = firestore.client()
    user_ref = db.collection('users')
    page_size = 256 # Adjust the page size as needed
    last_doc = None
    page = 1

    while True:
    print(f"\nFetching page {page}...")

    # Construct the query with ordering by document ID
    query = user_ref.order_by(firestore.FieldPath.document_id()).limit(page_size)


    The firestore.FieldPath.document_id() doesn't appear to be valid.

    May I know what is the correct way?

    Continue reading...

Compartilhe esta Página