MONGOC_CLIENT_SET_READ_PREFS(3)

πŸ’… MONGOC_CLIENT_SET_READ_PREFS πŸ’…

okay so bestie, you're in libmongoc land and this is the page for MONGOC_CLIENT_SET_READ_PREFS(3) β€” she's a little function that decides where your reads go. literally the vibe-setter for your whole client. let's get into it 🫢

✨ SYNOPSIS ✨

void
mongoc_client_set_read_prefs (mongoc_client_t *client,
                              const mongoc_read_prefs_t *read_prefs);

🌸 DESCRIPTION 🌸

So what she does: she sets the default read preferences to use with future operations upon client. that's it, that's the whole gig. main character energy, minimal effort, maximum influence over everything that happens next πŸ’…

The global default is to read from the replica set primary. yes, out of the box she's a primary-girlie, no cap.

⚠️ big one, pay attention: it is a programming error to call this function on a client from a mongoc_client_pool_t. for pooled clients, set the read preferences with the MongoDB URI instead. fr fr, don't do it, i'm begging 😭

Please see the MongoDB website for a description of Read Preferences. (yes, the actual website, go look, it's giving "read the docs" but like, genuinely ✨)


πŸŽ€ PARAMETERS πŸŽ€

  • client: A mongoc_client_t. πŸ¦‹
  • read_prefs: A mongoc_read_prefs_t. 🌸

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” icons only, we stan πŸ’œ

2009-present, MongoDB, Inc.


and that's the whole page bestie!! mwah 🧚✨ this one was served to you by libmongoc 2.5.6, dated Oct 09, 2026 β€” go forth and set those read prefs responsibly, ilysm πŸŒˆπŸ’…

πŸ“¦ where this page comes from