
For example I have gender attribute in my collection. And then, I am going to get the total documents of male gender documents. What I want is that it returns me a number only. Like, I do not want in my client side to get the total length of documents. What I want that is in server side it will get the numbers of total documents and send this to client side.

For anything that need to do things that are not available with the Database SDK then I will use functions to achieve it. So in your case this is an example of how it work for you in JavaScript
module.exports = async function (req, res) {
let total = 0;
try {
const res = await database.listDocuments('db', 'collections', [
sdk.Query.equal('gender', MALE),
]);
total = res.total;
} catch (e) {
}
res.json({total: total});
};
I've omitted all Appwrite preparing code

If this is didn't what you've meant lmn

I see thank you sir
Recommended threads
- Adding "name" column to table creates 2-...
As stated, im adding the "name" column to one table, it adds 4 duplicates. In another table it adds 3 duplicates, and when I delete 1 of them, all duplucates di...
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
