MONGOC_SESSION_OPTS_SET_CAUSAL_CONSISTENCY - Online Linux Manual PageSection : 3
Updated : Feb 04, 2021
Source : 1.17.4
Note : libmongoc
NAMEmongoc_session_opts_set_causal_consistency − mongoc_session_opts_set_causal_consistency()
SYNOPSIS void
mongoc_session_opts_set_causal_consistency (mongoc_session_opt_t *opts,
bool causal_consistency);
Configure causal consistency in a session. If true (the default), each operation in the session will be causally ordered after the previous read or write operation. Set to false to disable causal consistency. See the MongoDB Manual Entry for Causal Consistency. Unacknowledged writes are not causally consistent. If you execute a write operation with a mongoc_write_concern_t on which you have called mongoc_write_concern_set_w with a value of 0, the write does not participate in causal consistency.
PARAMETERS • opts: A mongoc_session_opt_t. • causal_consistency: True or false.
EXAMPLE mongoc_client_t *client;
mongoc_session_opt_t *session_opts;
mongoc_client_session_t *client_session;
mongoc_collection_t *collection;
bson_t insert_opts = BSON_INITIALIZER;
bson_t *doc;
bson_error_t error;
bool r;
client = mongoc_client_new ("mongodb://example/?appname=session−opts−example");
mongoc_client_set_error_api (client, 2);
session_opts = mongoc_session_opts_new ();
mongoc_session_opts_set_causal_consistency (session_opts, false);
client_session = mongoc_client_start_session (client, session_opts, &error);
mongoc_session_opts_destroy (session_opts);
if (!client_session) {
fprintf (stderr, "Failed to start session: %s\n", error.message);
abort ();
}
collection = mongoc_client_get_collection (client, "test", "collection");
doc = BCON_NEW ("_id", BCON_INT32 (1));
r = mongoc_client_session_append (client_session, &insert_opts, NULL);
if (!r) {
fprintf (stderr, "mongoc_client_session_append failed: %s\n", error.message);
abort ();
}
r = mongoc_collection_insert_one (
collection, doc, &insert_opts, NULL /* reply */, &error);
if (!r) {
fprintf (stderr, "Insert failed: %s\n", error.message);
abort ();
}
AUTHORMongoDB, Inc
COPYRIGHT2017-present, MongoDB, Inc 0
Johanes Gumabo
Data Size : 8,470 byte
man-mongoc_session_opts_set_causal_consistency.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 199,122
Visitor ID : :
Visitor IP : 13.59.5.179 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.