1MONGOC_CLIENT_SESSION_WITH_TRANSMAoCnTgIoODNBM(O3CN)GDOrCi_vCeLrIENT_SESSION_WITH_TRANSACTION(3)
2
3
4
6 mongoc_client_session_with_transaction - mongoc_client_ses‐
7 sion_with_transaction()
8
10 bool
11 mongoc_client_session_with_transaction (mongoc_client_session_t *session,
12 mongoc_client_session_with_transaction_cb_t cb,
13 const mongoc_transaction_opt_t *opts,
14 void *ctx,
15 bson_t *reply,
16 bson_error_t *error);
17
18 This method will start a new transaction on session, run cb, and then
19 commit the transaction. If it cannot commit the transaction, the entire
20 sequence may be retried, and cb may be run multiple times. ctx will be
21 passed to cb each time it is called.
22
23 This method has an internal time limit of 120 seconds, and will retry
24 until that time limit is reached. This timeout is not configurable.
25
26 cb should not attempt to start new transactions, but should simply run
27 operations meant to be contained within a transaction. The cb does not
28 need to commit transactions; this is handled by the mongoc_client_ses‐
29 sion_with_transaction. If cb does commit or abort a transaction, how‐
30 ever, this method will return without taking further action.
31
32 The parameter reply is initialized even upon failure to simplify memory
33 management.
34
36 · session: A mongoc_client_session_t.
37
38 · cb: A mongoc_client_session_with_transaction_cb_t callback, which
39 will run inside of a new transaction on the session.
40
41 · opts: An optional mongoc_transaction_opt_t.
42
43 · ctx: A void*. This user-provided data will be passed to cb.
44
45 · reply: An optional location to initialize a bson_t or NULL. This
46 should be on the stack.
47
48 · error: An optional location for a bson_error_t or NULL.
49
51 Returns true if the transaction was completed succesfully. Otherwise,
52 returns false in case of failure. In cases of failure error will also
53 be set, except if the passed-in cb fails without setting error. If a
54 non-NULL reply is passed in, reply will be set to the value of the last
55 server response, except if the passed-in cb fails without setting a
56 reply.
57
59 MongoDB, Inc
60
62 2017-present, MongoDB, Inc
63
64
65
66
671.15.2 Nov 0M6O,NG2O0C1_9CLIENT_SESSION_WITH_TRANSACTION(3)