Skip to content

Commit 5cd215b

Browse files
authored
Fix batchSize behaviour for getMore (#793)
1 parent d08ef11 commit 5cd215b

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/libmongoc/src/mongoc/mongoc-cursor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ _mongoc_cursor_prepare_getmore_command (mongoc_cursor_t *cursor,
17091709
bson_append_int64 (command,
17101710
MONGOC_CURSOR_BATCH_SIZE,
17111711
MONGOC_CURSOR_BATCH_SIZE_LEN,
1712-
abs (_mongoc_n_return (cursor)));
1712+
batch_size);
17131713
}
17141714

17151715
/* Find, getMore And killCursors Commands Spec: "In the case of a tailable

src/libmongoc/tests/json/command_monitoring/find.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
},
357357
"collection": "test",
358358
"batchSize": {
359-
"$numberLong": "1"
359+
"$numberLong": "3"
360360
}
361361
},
362362
"command_name": "getMore",
@@ -497,7 +497,7 @@
497497
},
498498
"collection": "test",
499499
"batchSize": {
500-
"$numberLong": "1"
500+
"$numberLong": "3"
501501
}
502502
},
503503
"command_name": "getMore",

src/libmongoc/tests/json/unified/poc-command-monitoring.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
]
150150
},
151151
"collection": "test",
152-
"batchSize": 1
152+
"batchSize": 3
153153
},
154154
"commandName": "getMore",
155155
"databaseName": "command-monitoring-tests"

src/libmongoc/tests/test-mongoc-cursor.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ _test_cursor_n_return_find_cmd (mongoc_cursor_t *cursor,
19081908
&getmore_cmd, "batchSize", tmp_bson ("{'$exists': false}"));
19091909
}
19101910

1911-
ASSERT (match_bson (request_get_doc (request, 0), &getmore_cmd, true));
1911+
assert_match_bson (request_get_doc (request, 0), &getmore_cmd, true);
19121912

19131913
reply = bson_string_new (NULL);
19141914
cursor_finished = (reply_no == 2);
@@ -1956,28 +1956,28 @@ _test_cursor_n_return (bool find_with_opts)
19561956
0, /* skip */
19571957
3, /* limit */
19581958
0, /* batch_size */
1959-
{3, 2, 1}, /* expected_n_return */
1959+
{1, 1, 1}, /* expected_n_return */
19601960
{1, 1, 1} /* reply_length */
19611961
},
19621962
{
19631963
0, /* skip */
19641964
5, /* limit */
19651965
2, /* batch_size */
1966-
{2, 2, 1}, /* expected_n_return */
1966+
{2, 2, 2}, /* expected_n_return */
19671967
{2, 2, 1} /* reply_length */
19681968
},
19691969
{
19701970
0, /* skip */
19711971
4, /* limit */
19721972
7, /* batch_size */
1973-
{4, 2, 1}, /* expected_n_return */
1973+
{4, 7, 7}, /* expected_n_return */
19741974
{2, 1, 1} /* reply_length */
19751975
},
19761976
{
19771977
0, /* skip */
19781978
-3, /* limit */
19791979
1, /* batch_size */
1980-
{-3, -3, -3}, /* expected_n_return */
1980+
{1, 1, 1}, /* expected_n_return */
19811981
{1, 1, 1} /* reply_length */
19821982
}};
19831983

0 commit comments

Comments
 (0)