1MONGOC_SESSION_OPT_T(3) MongoDB C Driver MONGOC_SESSION_OPT_T(3)
2
3
4
6 mongoc_session_opt_t - mongoc_session_opt_t
7
8 #include <mongoc/mongoc.h>
9
10 typedef struct _mongoc_session_opt_t mongoc_session_opt_t;
11
13 Start a session with mongoc_client_start_session, use the session for a
14 sequence of operations and multi-document transactions, then free it
15 with mongoc_client_session_destroy(). Any mongoc_cursor_t or mon‐
16 goc_change_stream_t using a session must be destroyed before the ses‐
17 sion, and a session must be destroyed before the mongoc_client_t it
18 came from.
19
20 By default, sessions are causally consistent. To disable causal consis‐
21 tency, before starting a session create a mongoc_session_opt_t with
22 mongoc_session_opts_new() and call mongoc_session_opts_set_causal_con‐
23 sistency(), then free the struct with mongoc_session_opts_destroy.
24
25 Unacknowledged writes are prohibited with sessions.
26
27 A mongoc_client_session_t must be used by only one thread at a time.
28 Due to session pooling, mongoc_client_start_session may return a ses‐
29 sion that has been idle for some time and is about to be closed after
30 its idle timeout. Use the session within one minute of acquiring it to
31 refresh the session and avoid a timeout.
32
33 See the example code for mongoc_session_opts_set_causal_consistency.
34
36 MongoDB, Inc
37
39 2017-present, MongoDB, Inc
40
41
42
43
441.14.0 Feb 22, 2019 MONGOC_SESSION_OPT_T(3)