MONGOC_DATABASE_ADD_USER(3)

πŸ’– MONGOC_DATABASE_ADD_USER(3) πŸ’–

okay bestie, welcome to the MONGOC_DATABASE_ADD_USER(3) page from libmongoc ✨ this is the little API that shall create a new user with access to a database, and we are gonna go through every detail together. no cap, it's giving β€œshort but important” energy πŸ’…


✨ SYNOPSIS ✨

bool
mongoc_database_add_user (mongoc_database_t *database,
                          const char *username,
                          const char *password,
                          const bson_t *roles,
                          const bson_t *custom_data,
                          bson_error_t *error);

πŸŽ€ PARAMETERS πŸŽ€

  • database β€” A mongoc_database_t. this is the database bestie we're adding the user to πŸ’–
  • username β€” The name of the user. yes, the actual username, iconic behavior ✨
  • password β€” The cleartext password for the user. it's literally cleartext, so keep that in mind πŸ‘€
  • roles β€” An optional bson_t for roles. optional, but if you need roles, this is where they go πŸŽ€
  • custom_data β€” An optional bson_t for extra data. cute little bonus info slot πŸ¦‹
  • error β€” A location for a bson_error_t or NULL. this is where the tea gets reported if something goes wrong πŸ’€

This function shall create a new user with access to database. periodt. πŸ‘‘

WARNING: Do not call this function without TLS. fr fr, this is not the vibe to ignore 🚨

πŸ’€ ERRORS πŸ’€

Errors are returned through the error parameter and can include socket or other server side failures. so like, if the network is being messy or the server side is throwing a fit, that's the kind of thing that can show up here 😭


🌈 RETURNS 🌈

Returns true if the user was successfully added. Returns false and sets error if there are invalid arguments or a server or network error. straightforward, but still important, iykyk πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” yes, that MongoDB, Inc πŸ’…


2009-present, MongoDB, Inc. β€” protect the copyright, bestie 🫢


xoxo, this has been MONGOC_DATABASE_ADD_USER(3) from libmongoc, version 2.5.6, dated Oct 09, 2026 β€” go add those users safely, and remember the TLS warning, okay? πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from