MONGOC_CHANGE...T_RESUME_TOKEN(3)

πŸ’… MONGOC_CHANGE...T_RESUME_TOKEN(3) πŸ’…

okay so bestie, welcome to libmongoc β€” this is the page for mongoc_change_stream_get_resume_token, and honestly? it's a little guy with one job and it slays at it. πŸŽ€


✨ SYNOPSIS ✨

const bson_t *
mongoc_change_stream_get_resume_token (mongoc_change_stream_t *stream);

This function returns the cached resume token 🫢 β€” and like, the whole point is that you can pass that token as <highlight>either</highlight> the resumeAfter or the startAfter option of a watch function, and boom, you get a brand new change stream starting from the exact same point. no cap, that's the entire vibe. ✨


🌸 PARAMETERS 🌸

  • stream β€” a mongoc_change_stream_t. that's it. that's the whole parameter list. she's low maintenance. πŸ’…

πŸ¦‹ RETURNS πŸ¦‹

A bson_t that should not be modified or freed β€” like, hands off, bestie, it's not yours to mess with. πŸ™ˆ

It returns NULL if there's no resume token available. and when does that happen? it's possible if the change stream hasn't been iterated yet <highlight>and</highlight> neither the resumeAfter nor the startAfter options were specified in the watch function. so basically: no iteration, no options, no token. πŸ’€


🧚 LIFECYCLE 🧚

The returned bson_t is valid for the lifetime of stream β€” and heads up, its data may get updated if mongoc_change_stream_next() is called after this function. πŸ‘€ so if you're not trying to have the rug pulled out from under you, you can copy the value to extend its lifetime or to preserve the current resume token. protect your peace, protect your token. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


and that's the whole page, bestie β€” you ate that πŸ’…βœ¨

source/version: libmongoc 2.5.6 Β· dated Oct 09, 2026 Β· go forth and resume those streams πŸ¦‹

πŸ“¦ where this page comes from