
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
- my database attribute stuck in processin...
when i created attributes in collection 3 of those attributes become "processing", and they are not updating, the worst thing is that i cant even delete them s...
- Forever Processing Issue
I encountered an issue when creating attributes in the collections . if you create an attribute of type string for example and choose a size of 200 or 250 or a...
- Realtime Disconnects and Error: INVALID_...
Hi! I just want to ask here if there's any workaround with the disconnect issues we're encountering when subscribing to realtime events in react native using ex...
