I was using mongo driver for java 2.x and passed to 3.1.
DBCursor
is deprecated and I had to use the FindIterable<Document>
structure.
When I perform a query
FindIterable<Document> cursor=(mongo).getCollection().find(findArgs).limit(10).skip(0);
I would like to get the count of the total number of records in the resultset with the query find in only one Query.
How can I retrieve the count without performing another query? I'm not speaking of the 10 records in the limit but of the total number of records.
I want to perform one query to retrieve count and find. I don't want to execute find and count.
Thanks