Hi,
I'm running a query against a collection, which is queried by server code.
The query works fine in terms of pagination (start from X, show Y records).
But I can't seem to find a way of getting the total count of records whilst working within the server code.
Here is the definition of the query:
code
params.criteria = {
"post_category": {
"$in": [ categoryId, 6 ]
}
};
//Define other parameters
params.limit = maxEntries; //Show maximum 6 records
params.sort = "-post_timestamp" //Ascending sort by field "post_timestamp"
params.skip = start;
params.count = "1"
result.query = Collection.query(dbId, collectionName, params);
/code
But I can't find where to put the "count=1" parameter.
I've tried
params.count = 1;
params.count = "1";
params.count = true;
params.count = new Boolean(true);
And various other combinations that I can't remember now.
However, I end up with a variation of the following message in the trace:
message: java.lang.String cannot be cast to java.lang.Booleanncode: 0
Can you help please?
Regards,
Andy