.\" 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_CLIENT_SELECT_SERVER" "3" "May 07, 2024" "1.27.1" "libmongoc" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX mongoc_server_description_t * mongoc_client_select_server (mongoc_client_t *client, bool for_writes, const mongoc_read_prefs_t *prefs, bson_error_t *error) BSON_GNUC_WARN_UNUSED_RESULT; .EE .UNINDENT .UNINDENT .sp Choose a server for an operation, according to the logic described in the Server Selection Spec. .sp Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher\-level functions automatically select a suitable server. .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBclient\fP: A \fI\%mongoc_client_t\fP\&. .IP \(bu 2 \fBfor_writes\fP: Whether to choose a server suitable for writes or reads. .IP \(bu 2 \fBprefs\fP: An optional \fI\%mongoc_read_prefs_t\fP\&. If \fBfor_writes\fP is true, \fBprefs\fP must be NULL. Otherwise, use \fBprefs\fP to customize server selection, or pass NULL to use read preference PRIMARY. .IP \(bu 2 \fBerror\fP: An optional location for a \fI\%bson_error_t\fP or \fBNULL\fP\&. .UNINDENT .SH RETURNS .sp A \fI\%mongoc_server_description_t\fP that must be freed with \fI\%mongoc_server_description_destroy()\fP\&. If no suitable server is found, returns NULL and \fBerror\fP is filled out. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .