GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MONGOC_CLIENT_SELECT_SERVER(3) libmongoc MONGOC_CLIENT_SELECT_SERVER(3)

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);


Choose a server for an operation, according to the logic described in the Server Selection Spec.

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.

  • client: A mongoc_client_t.
  • for_writes: Whether to choose a server suitable for writes or reads.
  • prefs: An optional mongoc_read_prefs_t. If for_writes is true, prefs must be NULL. Otherwise, use prefs to customize server selection, or pass NULL to use read preference PRIMARY.
  • error: An optional location for a bson_error_t or NULL.

A mongoc_server_description_t that must be freed with mongoc_server_description_destroy(). If no suitable server is found, returns NULL and error is filled out.

MongoDB, Inc

2009-present, MongoDB, Inc.

July 3, 2025 1.30.4

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.