MONGOC_READ_PREFS_SET_HEDGE(3)

πŸ’… MONGOC_READ_PREFS_SET_HEDGE(3) β€” the libmongoc glow-up page πŸ¦‹

okay bestie, so this one comes with a big warning label and honestly? she's serving "beloved but cancelled" energy 😭

⚠️ Deprecated since version MongoDB: Server 8.0 ⚠️ Hedged reads are deprecated in MongoDB version 8.0 and will be removed in a future release. ngl, if you're building something new, don't get attached β€” this girl is on her way out the door πŸ’€

✨ SYNOPSIS ✨

void
mongoc_read_prefs_set_hedge (mongoc_read_prefs_t *read_prefs,
                             const bson_t *hedge);

πŸŽ€ PARAMETERS πŸŽ€

  • read_prefs β€” a mongoc_read_prefs_t. that's the read prefs struct you're about to touch πŸ’…
  • hedge β€” a bson_t. this is the hedge document, the whole vibe of the call fr

🌸 DESCRIPTION 🌸

so what does this even do? mongoc_read_prefs_set_hedge sets the hedge document to be used for the read preference. simple as that, no cap 🫢

here's the fun part though β€” sharded clusters running MongoDB 4.4 or later can dispatch read operations in parallel, return the result from the fastest host, and cancel the unfinished operations. it's giving main character energy: whoever answers first wins, everyone else gets ghosted ✨πŸ”₯

for example, this right here is a valid hedge document:

{
   enabled: true
}

and the appropriate values for the enabled key? just true or false. that's the whole menu, bestie πŸ’–

lowkey reminder that this whole feature is deprecated as of MongoDB Server 8.0 and slated for removal in a future release β€” so enjoy the parallel-reads fantasy while it lasts πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” iconic, we stan 🧚


2009-present, MongoDB, Inc. β€” periodt πŸ’œ


okay that's the whole page!! you read it, you understood it, you slayed πŸ’…βœ¨ β€” and here's the cute little sign-off from the footer: this is version 2.5.6, dated Oct 09, 2026, brought to you by libmongoc πŸŽ€β­πŸ“

πŸ“¦ where this page comes from