Back

[SOLVED] still fighting with #dotnet-sdk document limitation

  • 0
  • Functions
  • Web
krennih
6 Oct, 2023, 06:09

Hey, this keeps behaving strange.

I asked this in general previously and added an issue to https://github.com/appwrite/sdk-for-dotnet/issues/28 already with no luck.

Maybe I got wrong what I found in the documents, but when I

ˋˋˋ{ int number = 5; try { List<string> queryList = new List<string>{ {Query.Equal("validated", false)}, {Query.Equal("language", lang)}, {Query.Limit(number)} } […] var quotes = await databases.ListDocuments( databaseId: databaseId, collectionId: collectionId, queries: queryList); return Results.Ok(quotes);
}ˋˋˋ

I would expect this to return a maximum of ˋ5ˋ Documents where ˋvalidatedˋ is ˋfalse ˋ and ˋlanguage ˋ is (whatever is set as query parameter). The .equal selection works but it keeps returning ALL the documents where they fit not just the first 5.

TL;DR
User is struggling with a document limitation issue in dotnet-sdk. They expected the code to return only 5 documents based on certain conditions, but it is returning all matching documents instead. They have tried posting the issue on GitHub but haven't received a solution yet. Solution: The user can try using the Query.Limit(5) method instead of passing the number as a parameter. This should set a limit on the number of documents returned.
Drake
6 Oct, 2023, 14:27

Put the 3 backticks on a line by itself to make the formatting show properly

Drake
6 Oct, 2023, 14:29

This does seem right...

Drake
6 Oct, 2023, 14:31

What's the omitted code?

How many documents do you have in your collection?

krennih
6 Oct, 2023, 14:52

I get 268 out of 345 back but that can easily become 1000+ soon 🙂 (zorry for the formatting. Wrote this on my tablet this morning)

Drake
6 Oct, 2023, 14:53

What makes you say you get 268 back?

krennih
6 Oct, 2023, 15:00

Haha…well… it says total:268 in the json … never really scrolled down 🫣

Drake
6 Oct, 2023, 18:47

Right that tells you how much is in the database with the filters applied so you can do pagination.

So does the response actually only contain 5 documents?

krennih
6 Oct, 2023, 19:42

Sure it does 🙈

krennih
6 Oct, 2023, 19:43

And I am due for vacation now.

Drake
6 Oct, 2023, 19:49

[SOLVED] still fighting with #dotnet-sdk document limitation

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