Search code examples
google-cloud-firestorelistener

Can I listen to individual value changes in a Firestore Document


I read the Get realtime updates with Cloud Firestore and wonder if I can listen for changes on a Document value or I must listen for changes to the Document (all values)

Lets say I have a Document:

{
    name: "Los Angeles",
    state: "CA",
    country: "USA"
}

And I only interested if country changes?


Solution

  • Firestore listeners respond to changes to a document. There is no way to only listen to a change to a specific field within the document(s).

    If you have a specific use-case where the document is prohibitively large, you could consider putting the field into separate, additional documents for this use-case.