summaryrefslogtreecommitdiff
path: root/src/mongo/client/dbclient_mockcursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/client/dbclient_mockcursor.cpp')
-rw-r--r--src/mongo/client/dbclient_mockcursor.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/client/dbclient_mockcursor.cpp b/src/mongo/client/dbclient_mockcursor.cpp
index 40b505c7abe..1647111c0b4 100644
--- a/src/mongo/client/dbclient_mockcursor.cpp
+++ b/src/mongo/client/dbclient_mockcursor.cpp
@@ -53,7 +53,13 @@ DBClientMockCursor::DBClientMockCursor(mongo::DBClientBase* client,
}
bool DBClientMockCursor::more() {
+ if (_batchSize && batch.pos == _batchSize) {
+ _fillNextBatch();
+ }
+ return batch.pos < batch.objs.size();
+}
+void DBClientMockCursor::_fillNextBatch() {
// Throw if requested via failpoint.
mockCursorThrowErrorOnGetMore.execute([&](const BSONObj& data) {
auto errorString = data["errorType"].valueStringDataSafe();
@@ -64,13 +70,6 @@ bool DBClientMockCursor::more() {
uasserted(errorCode, message);
});
- if (_batchSize && batch.pos == _batchSize) {
- _fillNextBatch();
- }
- return batch.pos < batch.objs.size();
-}
-
-void DBClientMockCursor::_fillNextBatch() {
int leftInBatch = _batchSize;
batch.objs.clear();
while (_iter.more() && (!_batchSize || leftInBatch--)) {