SYNOPSIS

mongoc_cursor_t *
mongoc_client_command (mongoc_client_t           *client,
                       const char                *db_name,
                       mongoc_query_flags_t       flags,
                       uint32_t                   skip,
                       uint32_t                   limit,
                       uint32_t                   batch_size,
                       const bson_t              *query,
                       const bson_t              *fields,
                       const mongoc_read_prefs_t *read_prefs);

bool
mongoc_client_command_simple (mongoc_client_t           *client,
                              const char                *db_name,
                              const bson_t              *command,
                              const mongoc_read_prefs_t *read_prefs,
                              bson_t                    *reply,
                              bson_error_t              *error);

DESCRIPTION

mongoc_client_command()

The mongoc_client_command() function shall execute a command via a client. This is performed lazily after calling mongoc_cursor_next() on the resulting cursor structure.

db

The database to execute the command on

command

The command to execute

For more on the meaning of the other parameters, see mongoc_cursor(7).

mongoc_client_command_simple()

The mongoc_client_command_simple() provides a wrapper around mongoc_client_command() for simple commands that don’t return a cursor.

read_prefs

read preference for the command

reply

optional out param for replies

error

optional location for errors

RETURN VALUE

The mongoc_client_command() function returns a mongoc_cursor(7).

The mongoc_client_command_simple() function returns true if successful, if false it sets error.

ERRORS

mongoc_client_command()

errors are detected through active use of the mongoc_cursor(7).

mongoc_client_command_simple()

errors may vary based on the command run and the client version.

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.