MONGOC_DATABASE_HAS_COLLECTION(3)

πŸ’… MONGOC_DATABASE_HAS_COLLECTION(3) πŸ’…

okay so this one is from the libmongoc manual, bestie, and it's literally the "does this collection exist?" check ✨

🌸 SYNOPSIS 🌸

bool
mongoc_database_has_collection (mongoc_database_t *database,
                                const char *name,
                                bson_error_t *error);

This function checks to see if a collection exists on the MongoDB server within database. It's giving collection vibe check, no cap πŸ‘‘

πŸŽ€ PARAMETERS πŸŽ€

  • database β€” a mongoc_database_t. That's the database we're looking inside 🫢
  • name β€” a string containing the name of the collection. Like, the collection's name, periodt πŸ’…
  • error β€” an optional location for a bson_error_t, or NULL. You can pass a spot for it, or just pass NULL if you don't want it 🌸

πŸ’€ ERRORS πŸ’€

Errors are propagated via the error parameter. So if something goes sideways, it rides out through error, iykyk 😭

πŸ‘‘ RETURNS πŸ‘‘

If the function succeeds, it returns true if the collection exists and false if not, and in either case the fields of error are cleared, if error is not NULL. Cleanup slay ✨

Returns false and sets error if there are invalid arguments or a server or network error. Not iconic, but that's the deal πŸ’€

🌈 AUTHOR 🌈

MongoDB, Inc

2009-present, MongoDB, Inc.


later, bestie 🫢 this page is from libmongoc, version 2.5.6, dated Oct 09, 2026 πŸŽ€

πŸ“¦ where this page comes from