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β amongoc_read_prefs_t. that's the read prefs struct you're about to touch πhedgeβ abson_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 π§
π COPYRIGHT π
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
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms