Skip to content

Commit 3063bcf

Browse files
authored
CDRIVER-4026 Restore specified cursor behaviour (#803)
* CDRIVER-4026 Specify 5.0 cursor behaviour Revert "Fix batchSize behaviour for getMore (#793)" This reverts commit 5cd215b. The spec tests in this commit are synced to commit 9da20b4b from the mongodb/specifications repository. * Restore usage of assert_match_bson
1 parent 0f17112 commit 3063bcf

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-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-
batch_size);
1712+
abs (_mongoc_n_return (cursor)));
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
},
357357
"collection": "test",
358358
"batchSize": {
359-
"$numberLong": "3"
359+
"$numberLong": "1"
360360
}
361361
},
362362
"command_name": "getMore",
@@ -413,8 +413,9 @@
413413
]
414414
},
415415
{
416-
"description": "A successful find event with a getmore and the server kills the cursor",
416+
"description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)",
417417
"ignore_if_server_version_less_than": "3.1",
418+
"ignore_if_server_version_greater_than": "4.4",
418419
"ignore_if_topology_type": [
419420
"sharded"
420421
],
@@ -497,7 +498,7 @@
497498
},
498499
"collection": "test",
499500
"batchSize": {
500-
"$numberLong": "3"
501+
"$numberLong": "1"
501502
}
502503
},
503504
"command_name": "getMore",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
],
5858
"tests": [
5959
{
60-
"description": "A successful find event with a getmore and the server kills the cursor",
60+
"description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)",
6161
"runOnRequirements": [
6262
{
6363
"minServerVersion": "3.1",
64+
"maxServerVersion": "4.4.99",
6465
"topologies": [
6566
"single",
6667
"replicaset"

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,28 +1955,28 @@ _test_cursor_n_return (bool find_with_opts)
19551955
0, /* skip */
19561956
3, /* limit */
19571957
0, /* batch_size */
1958-
{1, 1, 1}, /* expected_n_return */
1958+
{3, 2, 1}, /* expected_n_return */
19591959
{1, 1, 1} /* reply_length */
19601960
},
19611961
{
19621962
0, /* skip */
19631963
5, /* limit */
19641964
2, /* batch_size */
1965-
{2, 2, 2}, /* expected_n_return */
1965+
{2, 2, 1}, /* expected_n_return */
19661966
{2, 2, 1} /* reply_length */
19671967
},
19681968
{
19691969
0, /* skip */
19701970
4, /* limit */
19711971
7, /* batch_size */
1972-
{4, 7, 7}, /* expected_n_return */
1972+
{4, 2, 1}, /* expected_n_return */
19731973
{2, 1, 1} /* reply_length */
19741974
},
19751975
{
19761976
0, /* skip */
19771977
-3, /* limit */
19781978
1, /* batch_size */
1979-
{1, 1, 1}, /* expected_n_return */
1979+
{-3, -3, -3}, /* expected_n_return */
19801980
{1, 1, 1} /* reply_length */
19811981
}};
19821982

0 commit comments

Comments
 (0)