For now, a query gives a collection of rows, and the total number of rows. I’d like to discuss the inclusion of a new field that I’d find useful when using a limit. This would be either the index of the first row in the collection, or a boolean flag indicating whether there are still some rows after the retrieved ones.
Imagine the following case: you have a query that you access with pagination as described in this blog article. While you know the first time that you begin at index 0, for the second page you don’t know anymore the indexes you display. You could store a page number along, but this would be potentially wrong, as while you’re browsing the pages, new documents could be inserted in-between.
If the number of retrieved rows is equal to the limit of the query, you can’t tell if the page you display currently is the last page or not. Therefore, you need to make another query, which could yield no rows. This could be prevented if a query informs whether it’s the last query to make.
I don’t know the costs of executing a query with no results versus adding a new field to the response stream.