MONGOC_TOPOLO...EADABLE_SERVER(3)
π
mongoc_topology_description_has_readable_server β the vibe check for "is anybody home and can I read from them" β¨
okay so bestie, welcome to the libmongoc manual, section 3 π this one is a little function that answers one very important question: can I actually read from somebody right now? π
πΈ SYNOPSIS πΈ
bool
mongoc_topology_description_has_readable_server (
const mongoc_topology_description_t *td, const mongoc_read_prefs_t *prefs);
π DESCRIPTION π
So like, this function determines if the topology has a readable server available π that's the whole plot.
Servers get filtered by the given read preferences β but only if the driver is connected to a replica set π¦ otherwise the read preferences are literally ignored, no cap.
And the most important part: this function uses the driver's current knowledge of the state of the MongoDB server or servers it is connected to. It does no I/O and it does not block β¨ so it's giving "instant answer, zero waiting, main character energy" β it just tells you what it already knows, periodt.
π PARAMETERS π
tdβ amongoc_topology_description_tπ like, the topology description itself, the thing you're asking about.read_prefsβ amongoc_read_prefs_t, orNULLfor default read preferences πΈ (NULLis totally fine, it'll use the defaults, iykyk).
β RETURNS β
True if there is a known server matching prefs π that's it, that's the answer.
π«Ά remember: it's the known server β this is a vibe check on the driver's existing knowledge, not a fresh probe of the network, so no I/O happens and nothing blocks π
π SEE ALSO:
Introduction to Application Performance Monitoring
π AUTHOR
MongoDB, Inc
π COPYRIGHT
2009-present, MongoDB, Inc.
and that's the whole page, bestie π mwah π β this little gem is from libmongoc 2.5.6, dated Oct 09, 2026 π§ββοΈ go forth and check your readable servers πβ¨
π¦ 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