Is there a preferred way to query mongo with a limit and know whether there will be more results if I query for the next page with skip/limit?
What I have been doing is asking for one more document than I need, slicing it off the end, and using the existence of that extra document to know whether another query will give at least one more result.
n = 10
docs = db.documents.find({'foo': 'bar'}).limit(n+1)
more = docs.count() > n
docs = docs[:n]
I feel like this is a common use case (knowing whether or not to show an "more results" button on a website) and I feel stupid with my current solution.