1MONGOC_SESSION_OPTS_NEW(3)         libmongoc        MONGOC_SESSION_OPTS_NEW(3)
2
3
4

SYNOPSIS

6          mongoc_session_opt_t *
7          mongoc_session_opts_new (void);
8
9       Start a session with mongoc_client_start_session(), use the session for
10       a sequence of operations and multi-document transactions, then free  it
11       with    mongoc_client_session_destroy().    Any    mongoc_cursor_t   or
12       mongoc_change_stream_t using a session must  be  destroyed  before  the
13       session,  and a session must be destroyed before the mongoc_client_t it
14       came from.
15
16       By default, sessions are causally consistent. To disable causal consis‐
17       tency,  before  starting  a  session create a mongoc_session_opt_t with
18       mongoc_session_opts_new()                   and                    call
19       mongoc_session_opts_set_causal_consistency(), then free the struct with
20       mongoc_session_opts_destroy().
21
22       Unacknowledged writes are prohibited with sessions.
23
24       A mongoc_client_session_t must be used by only one thread  at  a  time.
25       Due to session pooling, mongoc_client_start_session() may return a ses‐
26       sion that has been idle for some time and is about to be  closed  after
27       its  idle timeout. Use the session within one minute of acquiring it to
28       refresh the session and avoid a timeout.
29
30       See the example code for mongoc_session_opts_set_causal_consistency().
31

RETURNS

33       A    new    mongoc_session_opt_t    that    must    be    freed    with
34       mongoc_session_opts_destroy().
35

AUTHOR

37       MongoDB, Inc
38
40       2017-present, MongoDB, Inc
41
42
43
44
451.25.1                           Nov 08, 2023       MONGOC_SESSION_OPTS_NEW(3)
Impressum