MONGOC_CLIENT_GET_SERVER_STATUS(3)

✨ hey bestie, it's mongoc_client_get_server_status ✨

so like. this is a page from libmongoc, and the function we're talking about is mongoc_client_get_server_status. πŸ’…


⚠️ WARNING, and I mean it: this one is deprecated since version 1.10.0. the glow-up replacement is to run the serverStatus command directly with mongoc_client_read_command_with_opts() instead. ok? ok. 🫢

πŸ“œ SYNOPSIS

bool
mongoc_client_get_server_status (mongoc_client_t *client,
                                 mongoc_read_prefs_t *read_prefs,
                                 bson_t *reply,
                                 bson_error_t *error);

🌸 DESCRIPTION

okay so what this does is it queries the server for its current server status, and the result gets dropped into reply. that's the whole vibe. πŸ¦‹

and listen, this part matters: reply is always initialized, even when things go sideways and it fails. so always call bson_destroy() to release it. always. no exceptions, bestie, we do not leak memory in this house. 😭


πŸŽ€ PARAMETERS

  • client β€” a mongoc_client_t. your client. the main character. πŸ‘‘
  • read_prefs β€” a mongoc_read_prefs_t. the read prefs, doing their read prefs thing.
  • reply β€” a maybe-NULL pointer to overwritable storage for a bson_t, which is where the results are gonna live. ✨
  • error β€” an optional location for a bson_error_t, or NULL if you're feeling unbothered. πŸ™ˆ

πŸ’€ ERRORS

errors get propagated via the error parameter. that's the pipeline. that's how you find out. πŸ”₯


⭐ RETURNS

  • returns true if it's successful. slay. πŸ’–
  • returns false and sets error if there are invalid arguments, or if there's a server or network error. not slay, but at least you know. 😭

🧚 AUTHOR

MongoDB, Inc

2009-present, MongoDB, Inc.


ok that's the whole page, mwah πŸ’‹ β€” this was libmongoc 1.30.13, dated Oct 09, 2024. go forth and maybe use the non-deprecated one, i'm just saying. 🫢✨

πŸ“¦ where this page comes from