Scroll to navigation

MONGOC_CLIENT_SESSION_GET_SNAPSHOT_TIME(3) libmongoc MONGOC_CLIENT_SESSION_GET_SNAPSHOT_TIME(3)

SYNOPSIS

bool
mongoc_client_session_get_snapshot_time (const mongoc_client_session_t *session,

uint32_t *timestamp,
uint32_t *increment,
bson_error_t *error);


Get the session's snapshot time, expressed as a BSON Timestamp with timestamp and increment components. The snapshot time is either the value passed to mongoc_session_opts_set_snapshot_time() <> when the session was started, or the atClusterTime returned by the server on the session's first read operation ("find", "aggregate" or "distinct").

Calling this function on a session that was not started with mongoc_session_opts_set_snapshot() <> set to true is an error. If the session is a snapshot session but no snapshot time has been established yet (no read operation has completed and no snapshot time was configured), this function returns false without setting error.

PARAMETERS

  • session: A mongoc_client_session_t <>.
  • 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 <https://www.mongoc.org/libbson/current/bson_error_t.html>, or NULL.

RETURNS

Returns true and populates timestamp and increment if the snapshot time is available. Returns false otherwise, setting error if the session is not a snapshot session.

Author

MongoDB, Inc

Copyright

2009-present, MongoDB, Inc.

August 27, 2026 2.5.1