MONGOC_CLIENT..._SNAPSHOT_TIME(3)

πŸ“¦
version 2.5.6 Β· 2 versions
, in epel 10

πŸ’… MONGOC_CLIENT..._SNAPSHOT_TIME(3) ✨

okay so bestie, this one lives in libmongoc and it's literally the glow-up for your session's snapshot time πŸ‘‘ like, no cap.


🌸 SYNOPSIS 🌸

          bool
          mongoc_client_session_get_snapshot_time (const mongoc_client_session_t *session,
                                                   uint32_t *timestamp,
                                                   uint32_t *increment,
                                                   bson_error_t *error);

πŸŽ€ DESCRIPTION πŸŽ€

So this function pulls the session's snapshot time and hands it to you as a BSON Timestamp, split all cute into a timestamp component and an increment component 🫢.

Now, where does that snapshot time even come from? Two vibes only:

  • it's the value you passed to mongoc_session_opts_set_snapshot_time() when the session was started, or
  • it's the atClusterTime the server handed back on the session's very first read operation β€” and by read op I mean "find", "aggregate" or "distinct" πŸ‘€
🚨 real talk: calling this function on a session that was not started with mongoc_session_opts_set_snapshot() set to true is an error. periodt.

And if the session is a snapshot session but no snapshot time has been established yet β€” like, no read operation has completed and no snapshot time was configured β€” this function returns false without setting error. she just says nope, quietly πŸ’€ no drama, no error message.


πŸ¦‹ PARAMETERS πŸ¦‹

  • session β€” A mongoc_client_session_t. the main character πŸ’œ
  • timestamp β€” A pointer to a uint32_t to receive the timestamp component ✨
  • increment β€” A pointer to a uint32_t to receive the increment component ✨
  • error β€” An optional location for a bson_error_t, or NULL πŸ™ˆ

🌈 RETURNS 🌈

Returns true and populates timestamp and increment if the snapshot time is available β€” slay, it worked πŸ’–. Returns false otherwise, and sets error if the session is not a snapshot session πŸ‘‘


⭐ AUTHOR ⭐

MongoDB, Inc β€” the icons behind it all πŸ‘‘


2009-present, MongoDB, Inc. 🫢


and that's the whole tea, bestie πŸ§šπŸ’… β€” this page was brought to you by libmongoc 2.5.6, dated Oct 09, 2026, ilysm, go forth and snapshot responsibly βœ¨πŸŽ€

πŸ“¦ where this page comes from