BSON_HAS_FIELD(3)
π BSON_HAS_FIELD(3) β the libbson glow-up
Okay bestie, so you're poking around in libbson and you need to know if some field is actually in there before you go grabbing it like it owes you money. That's literally what bson_has_field is for. It's a vibe check for keys. π
β¨ SYNOPSIS β¨
bool
bson_has_field (const bson_t *bson, const char *key);
That's it. That's the whole signature. Two args, one bool back. Iconic behavior, no notes. π«Ά
πΈ PARAMETERS πΈ
bsonβ abson_t. Yeah, the actual document you're digging through, bestie. Not a copy, not a vibe, the real thing.keyβ a string holding the name of the field you wanna check for. This is your little search term. π
π¦ DESCRIPTION π¦
So what it does: it checks to see if key contains an element named key. That's the check. Simple, clean, slay.
And here's the part that's giving main character energy: it also accepts "dotkey" notation like "a.b.c.d". So you can reach all the way down into nested documents without doing the whole manual descend-yourself thing. Ngl, that's the feature. That's the moment. β¨
"a.b.c.d"
Just pass it in and let it cook. π₯
β RETURNS β
trueifkeywas found withinbsonπ- otherwise
falseπ
No in-between, no "maybe", no situationship. It's a bool, it commits.
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
Fr fr, that's the whole page β nothing hiding in the fine print. Go check your fields, bestie. π§
That was BSON_HAS_FIELD(3) from libbson, version 2.5.6, dated Oct 09, 2026 β mwah, talk later π
π¦ where this page comes from
- epel 10: libbson-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