MONGOC_COLLECTION_DELETE(3)
π MONGOC_COLLECTION_DELETE(3) β the libmongoc girlie's guide
okay bestie, come sit with me, we need to talk about mongoc_collection_delete π«Ά
β οΈ WARNING, and I mean it, no cap: this one is deprecated since version 1.9.0. Like, it's giving "still in the group chat but never replies". Please usemongoc_collection_remove(),mongoc_collection_delete_one()ormongoc_collection_delete_many()instead. Those are the main characters now. π
β¨ SYNOPSIS β¨
bool
mongoc_collection_delete (mongoc_collection_t *collection,
mongoc_delete_flags_t flags,
const bson_t *selector,
const mongoc_write_concern_t *write_concern,
bson_error_t *error);
that's the whole vibe. five args, one bool, let's get into it π
π PARAMETERS π
collectionβ amongoc_collection_t. the collection we're doing all this on, obviously πflagsβ amongoc_delete_flags_t. yes it's a whole type, and yes it matters, keep reading πselectorβ abson_tholding the query that matches the documents you wanna delete. this is your hit list, basically π―write_concernβ amongoc_write_concern_t, orNULL. your choice bestie,NULLis valid πerrorβ an optional spot for abson_error_t, orNULL. optional!! you can absolutely passNULLand live your truth β¨
π¦ DESCRIPTION π¦
so this function shall delete documents in the given collection that match selector. simple, iconic, exactly what it says on the tin π
now here's the thing β the bson selector is not validated. not even a little. it's just passed along as appropriate to the server. so compatibility and errors? that's a you problem, and by "you" I mean the appropriate server documentation. go read it, I'm begging π
and if you wanna limit your deletes to a single document β like, just the one, not the whole friend group β provide MONGOC_DELETE_SINGLE_REMOVE in flags. periodt πΈ
π ERRORS π
errors get propagated via the error parameter. that's the whole section. she's short but she's honest π«Ά
π₯ RETURNS π₯
returns true if successful. returns false and sets error if there are invalid arguments, or a server or network error. so like, false is never a mystery, the error will tell you what's up π§
π also: a write concern timeout or a write concern error counts as a failure. yes, even if it feels like it kind of worked. it did not. it's a fail. don't argue with me π
π AUTHOR π
MongoDB, Inc. the original icons. π«‘
π COPYRIGHT π
2009-present, MongoDB, Inc. β protected, babes, don't be weird about it π
and that's the whole page, bestie!! this was libmongoc version 1.30.13, dated Oct 09, 2026, and the page you just read is MONGOC_COLLECTION_DELETE(3). now go use mongoc_collection_remove() like I told you ππ bye!! π
π¦ where this page comes from
- fedora 43: mongo-c-driver-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- fedora 43: mongo-c-driver-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms