.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MONGOC_SESSION_OPTS_NEW" "3" "Feb 25, 2024" "1.26.0" "libmongoc" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX mongoc_session_opt_t * mongoc_session_opts_new (void); .EE .UNINDENT .UNINDENT .sp Start a session with \fI\%mongoc_client_start_session()\fP, use the session for a sequence of operations and multi\-document transactions, then free it with \fI\%mongoc_client_session_destroy()\fP\&. Any \fI\%mongoc_cursor_t\fP or \fI\%mongoc_change_stream_t\fP using a session must be destroyed before the session, and a session must be destroyed before the \fI\%mongoc_client_t\fP it came from. .sp By default, sessions are \fI\%causally consistent\fP\&. To disable causal consistency, before starting a session create a \fI\%mongoc_session_opt_t\fP with \fI\%mongoc_session_opts_new()\fP and call \fI\%mongoc_session_opts_set_causal_consistency()\fP, then free the struct with \fI\%mongoc_session_opts_destroy()\fP\&. .sp Unacknowledged writes are prohibited with sessions. .sp A \fI\%mongoc_client_session_t\fP must be used by only one thread at a time. Due to session pooling, \fI\%mongoc_client_start_session()\fP may return a session that has been idle for some time and is about to be closed after its idle timeout. Use the session within one minute of acquiring it to refresh the session and avoid a timeout. .sp See the example code for \fI\%mongoc_session_opts_set_causal_consistency()\fP\&. .SH RETURNS .sp A new \fI\%mongoc_session_opt_t\fP that must be freed with \fI\%mongoc_session_opts_destroy()\fP\&. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .