Back

How to tell if document was created/updated/deleted in a channel

  • 0
  • Databases
  • Web
Ninjonik
1 Jan, 2024, 13:12

Hello,

if I'm subscribed to changes in a collection like this: databases.${database}.collections.usersRelations.documents

is there an easy/better way how I can tell if a specific document was created/updated/deleted? Or do I just need to check if for example databases.${database}.collections.usersRelations.documents.*.create event is inside of the response.events?

TL;DR
The user wants to know how to determine if a document was created, updated, or deleted in a specific channel. The suggested solution is to check the events for the presence of ".create", ".update", or ".delete" at the end. The user also asks if there is a better way and if they need to check for specific events in the response.
Drake
1 Jan, 2024, 22:44

Checking the event is the way to go

Drake
1 Jan, 2024, 22:44

The first event is the most specific. And you can check the end if it has .create, .update, etc.

Ninjonik
2 Jan, 2024, 08:37

alright, thank you

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more