BSON_SUBTYPE_T(3)

πŸ’… BSON_SUBTYPE_T(3) β€” like, the libbson manual page, bestie πŸŽ€

✨ NAME ✨

Binary Field Subtype β€” no cap, that's literally what this whole page is about πŸ¦‹


🌸 SYNOPSIS 🌸

okay so first thing, you gotta pull in the header:

#include <bson/bson.h>

and then boom, here's the enum in all its glory πŸ‘‘

typedef enum {
   BSON_SUBTYPE_BINARY = 0x00,
   BSON_SUBTYPE_FUNCTION = 0x01,
   BSON_SUBTYPE_BINARY_DEPRECATED = 0x02,
   BSON_SUBTYPE_UUID_DEPRECATED = 0x03,
   BSON_SUBTYPE_UUID = 0x04,
   BSON_SUBTYPE_MD5 = 0x05,
   BSON_SUBTYPE_COLUMN = 0x07,
   BSON_SUBTYPE_SENSITIVE = 0x08,
   BSON_SUBTYPE_VECTOR = 0x09,
   BSON_SUBTYPE_USER = 0x80,
} bson_subtype_t;

ten subtypes, zero notes, we love to see it ✨


πŸ’œ DESCRIPTION πŸ’œ

so this enum is basically the little vibe-check tag for binary fields β€” it holds all the various subtypes that may be used in a binary field πŸ”₯

want the full lore? it's all over at http://bsonspec.org β€” go read it, fr fr 🫢


πŸŽ€ EXAMPLE πŸŽ€

here's the moment you've been waiting for, the actual code:

bson_t doc = BSON_INITIALIZER;

BSON_APPEND_BINARY (&doc, "binary", BSON_SUBTYPE_BINARY, data, data_len);

see how we just slid BSON_SUBTYPE_BINARY right in there? iconic. ate. periodt. πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the ones who made it happen 🫑


2009-present, MongoDB, Inc. 🧚


that's the whole page bestie, every single enum value accounted for, nothing skipped, iykyk πŸ’–

alright that's a wrap 🌈 this was version 2.5.6, dated Oct 09, 2026, brought to you by the libbson girlies β€” mwah, go write some binary fields πŸ“πŸ’€πŸ¦‹

πŸ“¦ where this page comes from