MONGOC_COLLECT...SET_READ_PREFS(3)

okay bestie, welcome to the MONGOC_COLLECT...SET_READ_PREFS(3) page from the libmongoc manual 💅 this one is short and sweet — it’s giving “set the default read preferences for a collection” energy, and we are keeping every detail, no cap.

✨ SYNOPSIS ✨

Here’s the exact signature, straight from the group chat:

          void
          mongoc_collection_set_read_prefs (mongoc_collection_t *collection,
                                            const mongoc_read_prefs_t *read_prefs);

💖 PARAMETERS 💖

  • collection — a mongoc_collection_t. That’s the collection whose default read-prefs vibe we’re updating 💅
  • read_prefs — a mongoc_read_prefs_t. This is the read-preferences bundle you’re handing over 🫶

🌸 DESCRIPTION 🌸

This function sets the default read preferences to use for operations on collection that don’t specify a read preference. Lowkey iconic: the collection gets a default so the operation doesn’t have to bring its own.

The global default is MONGOC_READ_PRIMARY: if the client is connected to a replica set, it reads from the primary; otherwise, it reads from the current MongoDB server. That’s the whole read-preference situation, fr fr.

For the full Read Preferences lore, the page says please see the MongoDB website for a description of Read Preferences ✨

👑 AUTHOR 👑

MongoDB, Inc — author credit, periodt.

2009-present, MongoDB, Inc. — copyright line, preserved exactly 🫶


source/version + date sign-off: this page is from libmongoc version 2.5.6, with footer date Oct 09, 202 (yes, that’s what the footer shows — the last bit runs into the title 💀). byeee bestie, go set those read prefs 💖✨

📦 where this page comes from