getUserEventSummaryE(userId) {
return docData(doc(this.firestore, `/user/${userId}/event_summary/current/`), {idField : 'playing_summary'}).
pipe(distinctUntilChanged((prev, curr) => _.isEqual(prev, curr)));
}
getUserEventSummaryE should only return document when playing_summary changes but current it returning document data when other than playing_summary
key value changes.
Example Document data
{
id: 1,
playing_summary: 'playing',
userbalance: 222,
dob: '2021-05-02'
}
When I change Other than playing_summary
then currently changes triggering.
CodePudding user response:
You can't listen to any key-values in the documents, but you can do that on document. It's only triggered when a document is updated.
exports.dbEventsOnUpdate = functions.firestore
.document('events/{eventId}').onUpdate(async (change,context) => {
const eventID = context.params.eventId;
const newValue = change.after.data();
const previousValue = change.before.data();
const titleIsUpdated = newValue.title !== previousValue.title;
})
You can check this link for more details.