Skip to content

Commit 4ca77f6

Browse files
committed
CDRIVER-3207 Update change stream docs example for resume token
1 parent 678c7b0 commit 4ca77f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libmongoc/tests/test-mongoc-sample-commands.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,7 +2554,7 @@ test_example_change_stream (mongoc_database_t *db)
25542554
bson_t opts = BSON_INITIALIZER;
25552555
mongoc_change_stream_t *stream;
25562556
const bson_t *change;
2557-
bson_iter_t iter;
2557+
const bson_t *resume_token = bson_new ();
25582558
bson_error_t error;
25592559

25602560
collection = mongoc_database_get_collection (db, "inventory");
@@ -2583,8 +2583,8 @@ test_example_change_stream (mongoc_database_t *db)
25832583
/* Start Changestream Example 3 */
25842584
stream = mongoc_collection_watch (collection, pipeline, NULL);
25852585
if (mongoc_change_stream_next (stream, &change)) {
2586-
bson_iter_init_find (&iter, change, "_id");
2587-
BSON_APPEND_VALUE (&opts, "resumeAfter", bson_iter_value (&iter));
2586+
resume_token = mongoc_change_stream_get_resume_token (stream);
2587+
BSON_APPEND_DOCUMENT (&opts, "resumeAfter", resume_token);
25882588

25892589
mongoc_change_stream_destroy (stream);
25902590
stream = mongoc_collection_watch (collection, pipeline, &opts);

0 commit comments

Comments
 (0)