Back

Query for Paging in One to Many Relationship

  • 0
  • Android
  • Databases
  • Cloud
Prateek
23 Apr, 2024, 05:20

I have created collection in database, let's assume the collection name is "category", this category will contain id, name and List<Post>. Now when I'm querying it from client side, it is giving me all the posts lies in the specific category. For example, If category1 contains 8 posts, it returns all 8, instead I want paging capability like I can control the limits of number of posts.

TypeScript
 val listDocument = database.listDocuments(
                databaseId = DATABASE_ID,
                collectionId = CATEGORY_COLLECTION
 )

I don't found in the documentation related to this. Can anyone please suggest any approach? Thank you

TL;DR
Developers want to implement paging in a one-to-many relationship query for a category collection, where each category contains a list of posts. They are currently retrieving all posts for a specific category but want to control the limit of the number of posts returned. The solution involves modifying the query to include pagination parameters like `limit` and `offset` to restrict the number of posts retrieved per request.
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