Skip to content

Commit d277e2c

Browse files
committed
CDRIVER-3666 sort outcome collection
1 parent 8d120e2 commit d277e2c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libmongoc/tests/json-test.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ insert_data (const char *db_name,
10991099
}
11001100

11011101

1102-
static void
1102+
void
11031103
check_outcome_collection (mongoc_collection_t *collection, bson_t *test)
11041104
{
11051105
bson_t data;
@@ -1108,6 +1108,7 @@ check_outcome_collection (mongoc_collection_t *collection, bson_t *test)
11081108
mongoc_cursor_t *cursor;
11091109
bson_t query = BSON_INITIALIZER;
11101110
mongoc_read_prefs_t *prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
1111+
bson_t opts = BSON_INITIALIZER;
11111112

11121113
bson_lookup_doc (test, "outcome.collection.data", &data);
11131114
ASSERT (bson_iter_init (&iter, &data));
@@ -1121,7 +1122,9 @@ check_outcome_collection (mongoc_collection_t *collection, bson_t *test)
11211122
mongoc_collection_set_read_concern (collection, rc);
11221123
}
11231124

1124-
cursor = mongoc_collection_find_with_opts (collection, &query, NULL, prefs);
1125+
BCON_APPEND (&opts, "sort", "{", "_id", BCON_INT32 (1), "}");
1126+
cursor = mongoc_collection_find_with_opts (collection, &query, &opts, prefs);
1127+
bson_destroy (&opts);
11251128

11261129
while (bson_iter_next (&iter)) {
11271130
bson_t expected_doc;

0 commit comments

Comments
 (0)