MONGOC_CLIENT_...OPERATION_TIME(3)

πŸ’… MONGOC_CLIENT_...OPERATION_TIME(3) β€” like, the advance_operation_time glow-up ✨

okay so this is a page from libmongoc (yes, the C driver for MongoDB, she's iconic) and the star of the show is mongoc_client_session_advance_operation_time(). the title got a little mangled into MONGOC_CLIENT_...OPERATION_TIME(3) but don't let that fool you, the whole function name is right down there ⬇️ 🫢


✨ SYNOPSIS ✨

void
mongoc_client_session_advance_operation_time (mongoc_client_session_t *session,
                                              uint32_t timestamp,
                                              uint32_t increment);

so she's void, she takes three things, and she returns absolutely nothing β€” no notes, no drama, no return value. main character energy fr πŸ’…


bestie, here's the vibe: this function advances the session's operation time, and that operation time is expressed as a BSON Timestamp made up of a timestamp component and an increment component. two little pieces, one big vibe. πŸ•

⚠️ the actual tea: this only does anything if the new operation time is greater than the session's current operation time. if you try to move it backwards? nothing happens. she said "not today" πŸ’€

and here's the combo move you actually want: use mongoc_client_session_advance_operation_time() together with mongoc_client_session_advance_cluster_time() to copy the operationTime and clusterTime from another session. why? so that subsequent operations in this session are causally consistent with the last operation in that other session. it's giving passing the aux cord so both sessions are on the same track 🎧✨


πŸŽ€ PARAMETERS πŸŽ€

  • session β€” a mongoc_client_session_t. your session. the one you're advancing. 🫢
  • timestamp β€” the timestamp component of the new operationTime. πŸ•°οΈ
  • increment β€” the increment component of the new operationTime. like the timestamp's little sidekick πŸ”₯

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” yes, that MongoDB. slay.


2009-present, MongoDB, Inc. β€” iconic longevity, no cap.


and that's the whole page, bestie! this one came to you from libmongoc, version 2.5.6, dated Oct 09 (the year in the footer got cut off mid-number, so like… she's mysterious πŸ™ˆ). go forth and be causally consistent πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from