BSON_COPY_TO_EXCLUDING(3)

πŸ’– BSON_COPY_TO_EXCLUDING πŸ’–

okay bestie, this is a page from libbson, and it's giving "vintage but problematic" energy. Let's get into it ✨


🚨 WARNING 🚨

Deprecated since version 1.1.0: Use bson_copy_to_excluding_noinit() instead.

no cap, this one's been on the deprecated list since version 1.1.0. if you're writing new code, please use bson_copy_to_excluding_noinit() instead, i'm literally begging πŸ₯Ί

✨ SYNOPSIS ✨

void
bson_copy_to_excluding (const bson_t *src,
                        bson_t *dst,
                        const char *first_exclude,
                        ...);

🌸 PARAMETERS 🌸

  • src β€” A bson_t. this is your source, the main character we're copying from πŸ’…
  • dst β€” A bson_t. this is the destination, where the copied goodies land πŸŽ€
  • first_exclude β€” The first field name to exclude. yes queen, we're naming names and leaving them out πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

The bson_copy_to_excluding() function shall copy all fields from src to dst except those specified by the variadic, NULL terminated list of keys starting from first_exclude.

like... it's a copy, but make it ✨selective✨. everything comes over except the keys you listed, and that list keeps going until it hits a NULL. periodt. πŸ’œ

⚠️ WARNING: bson_init() is called on dst.

so yeah, heads up: dst gets bson_init() called on it. not a vibe check you can skip, it just happens πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc

2009-present, MongoDB, Inc.


and that's the whole page, bestie!! 🫢 this lil rewrite is from libbson 1.30.13, dated Oct 09, 2026 β€” so if you see that number floating around, that's us πŸ’– mwah, go use the non-deprecated version, ily, bye!! πŸŽ€βœ¨

πŸ“¦ where this page comes from