Back

How to get the list of documents in a realtime connection?

  • 0
  • Self Hosted
  • Flutter
  • Databases
  • Realtime
JulianLenz
14 Jul, 2023, 08:27

I have a realtime connection listening on 'databases.$_mainDatabaseId.collections.$_collectonId.documents' and the stream is emitting the created item. In my case I would like to have the stream of List<Document> .

To be more specific: I would like to listen to a specific query. Is that possible?

TL;DR
In a realtime connection, you can only have one document updated at a time, so having a list of documents doesn't make sense. If you want to filter documents, you'll need to do it client side in your callback function. There is a feature request to add server-side filtering by passing queries, so you can support the issue on GitHub. In your case, you can listen to a specific query by specifying it in the callback function.
Drake
14 Jul, 2023, 17:09

It really doesn't make sense to have a list of documents because only one document is updated at a time so it will always just be one document.

As for filtering, you'll have to filter client side in your callback. There's a feature request for filtering server side by passing some queries. I suggest you 👍 the issue: https://github.com/appwrite/appwrite/issues/2490

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