MONGOC_DATABASE_DROP_WITH_OPTS(3)
π MONGOC_DATABASE_DROP_WITH_OPTS π
okay bestie, so this is a page straight out of libmongoc (that's the MongoDB C driver, iykyk) and it's all about yeeting a whole database into the void. dramatic? maybe. necessary? absolutely. let's get into it π«Ά
β¨ SYNOPSIS β¨
bool
mongoc_database_drop_with_opts (mongoc_database_t *database,
const bson_t *opts,
bson_error_t *error);
literally just one function, three args, and a dream π
π PARAMETERS π
databaseβ amongoc_database_t, aka the database you're about to say bye-bye to πerrorβ an optional spot to stash abson_error_t, orNULLif you're feeling brave (no cap, if you passNULLyou get zero gossip about what went wrong)
so opts can be NULL, or it can be a BSON document stuffed with extra command options. here's the menu:
writeConcernβ build amongoc_write_concern_tand usemongoc_write_concern_append()to slide the write concern intoopts. there's example code over onmongoc_client_write_command_with_opts()if you want to see it in action β¨sessionIdβ first, make amongoc_client_session_twithmongoc_client_start_session(). you can kick off a transaction withmongoc_client_session_start_transaction(), optionally passing amongoc_transaction_opt_tthat overrides the options inherited fromdatabase, then usemongoc_client_session_append()to add the session toopts. example code lives withmongoc_client_session_tπcollationβ this one's for configuring textual comparisons. see Setting Collation Order, plus the MongoDB Manual entry on Collation. heads up though: collation requires MongoDB 3.2 or later β on anything older you get an error back, no mercy πserverIdβ wanna target one specific server? drop an int32"serverId"field in there. get the id by callingmongoc_client_select_server(), thenmongoc_server_description_id()on whatever it hands back π―
π¦ DESCRIPTION π¦
this function attempts to drop a database on the MongoDB server. that's it, that's the whole vibe. database? gone. β¨
if no write concern is provided in opts, the database's own write concern gets used instead β it's giving "inherited from the parent," honestly very main character of it π
the encryptedFields document in opts may be used to drop a collection used for Queryable Encryption π (yes, you read that right, and yes, we're keeping it exactly as written)
π ERRORS π
errors get propagated through the error parameter. simple as that, bestie π«Ά
β RETURNS β
returns true if it slayed. returns false and sets error if the arguments are invalid, or if there's a server or network error. so like β check it, yeah? π
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, bestie π
this beaut came to you from libmongoc, version 2.5.6, dated Oct 09, 2026 β go forth and drop responsibly, mwah ππ§
π¦ 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