Couchbase lite 2.0, DB22 How to obtain the count(*)

Hi,

What is the most effective way to make a count(*) ?

I did find the expression : SelectResult.All(), and called the linq count() methode?

Is there an expression like SelectResult.Count() that give a long as result ?

Any better way to do it ?

I’m working in Xamarin forms, c#.

Regards

Steeve

What about

//QueryBuilder. ...
var results = Query.Execute().ToList();
var count = results.Count();

Hi,

Thank you for answering.
Yes, it’s the only way I did find, but is that the better way to do it ?

Regards

Steeve

Not that I know of no.

Maybe you could take a look at the tests inside the GitHub Repo. I’m a real fan of looking at them. I learned a lot going through them. Look how @borrrden does it and learn from the master :+1:

1 Like

I’m pleased to find you on the right track already, but here is a part of the test that does it. Also a link to the two functions in question (note: each of the words has a separate link :wink: )