When batch size is reached try getting one more document

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      If users have specified a batch size and the number of the documents in the final batch exactly matches the number of documents, returned by a cursor, we are left with a cursor that will return EOF next time it is called.

      An example of this happening would be if find command have a limit and an equal batchSize.

      A way to fix it may be to always try stashing a document after we satisfy the batch size.
      For example, here: https://github.com/mongodb/mongo/blob/b19e7ed6fdaf5eea7a9851955bfdce1be767fa53/src/mongo/db/query/plan_executor.cpp#L108

      This way we will either get EOF avoiding an extra network interaction or just stash a single document in advance.

            Assignee:
            Unassigned
            Reporter:
            Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: