First of all, CBL’s ResultSet Swift class doesn’t implement underestimatedCount and the default implementation from the Sequence protocol will return 0. You may try the following.
- Check the number of docs by calling collection.count.
- From the query, you can do rs.allResults().count.