---
name: "mongoc_client_get_server_status"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_client_get_server_status"
---

# mongoc\_client\_get\_server\_status(3)

**WARNING:**

Deprecated since version 1.10.0: Run the *serverStatus* command directly with *mongoc\_client\_read\_command\_with\_opts()* instead.

## SYNOPSIS

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

Queries the server for the current server status. The result is stored in **reply**.

**reply** is always initialized, even in the case of failure. Always call *bson\_destroy()* to release it.

## PARAMETERS

- •

  **client**: A *mongoc\_client\_t*.

- •

  **read\_prefs**: A *mongoc\_read\_prefs\_t*.

- •

  **reply**: A maybe-**NULL** pointer to *overwritable storage* for a *bson\_t* to contain the results.

- •

  **error**: An optional location for a *bson\_error\_t* or **NULL**.

## ERRORS

Errors are propagated via the **error** parameter.

## RETURNS

Returns **true** if successful. Returns **false** and sets **error** if there are invalid arguments or a server or network error.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
