MONGOC_CLIENT_...FAULT_DATABASE(3)
π bestie, you're on the MONGOC_CLIENT_...FAULT_DATABASE(3) page from libmongoc π
okay so this is the whole glow-up of that manpage, and we're keeping every crumb. no cap. π«Ά
β¨ SYNOPSIS β¨
mongoc_database_t *
mongoc_client_get_default_database (mongoc_client_t *client);
okay so what does it do? It gets the database named in the MongoDB connection URI, or returns NULL if the URI specifies none. Useful when you want to choose which database to use based only on the URI in a configuration file. periodt. π
π PARAMETERS π
clientβ amongoc_client_t. that's the whole vibe. β¨
π RETURNS π
A newly allocated mongoc_database_t that should be freed with mongoc_database_destroy(). don't forget the cleanup, bestie π
π EXAMPLE π
π Default Database Example π
/* default database is "db_name" */
mongoc_client_t *client = mongoc_client_new ("mongodb://host/db_name");
mongoc_database_t *db = mongoc_client_get_default_database (client);
assert (!strcmp ("db_name", mongoc_database_get_name (db)));
mongoc_database_destroy (db);
mongoc_client_destroy (client);
/* no default database */
client = mongoc_client_new ("mongodb://host/");
db = mongoc_client_get_default_database (client);
assert (!db);
mongoc_client_destroy (client);
π AUTHOR π
MongoDB, Inc π
π COPYRIGHT π
2009-present, MongoDB, Inc.
mwah π and that's the tea: MONGOC_CLIENT_...FAULT_DATABASE(3) from libmongoc, version 2.5.6, dated Oct 09, 202. slay and read the docs, bestie π¦β¨
π¦ 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