SYNOPSIS

mongoc_cursor_t *
mongoc_database_command (mongoc_database_t         *database,
                         mongoc_query_flags_t       flags,
                         uint32_t                   skip,
                         uint32_t                   limit,
                         uint32_t                   batch_size,
                         const bson_t              *command,
                         const bson_t              *fields,
                         const mongoc_read_prefs_t *read_prefs);

bool
mongoc_database_command_simple (mongoc_database_t         *database,
                                const bson_t              *command,
                                const mongoc_read_prefs_t *read_prefs,
                                bson_t                    *reply,
                                bson_error_t              *error);

DESCRIPTION

mongoc_database_command()

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

command

The command to execute

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

mongoc_database_command_simple()

The mongoc_database_command_simple() provides a wrapper around mongoc_database_command() for simple commands that provide no response.

error

optional location for errors

RETURN VALUE

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

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

ERRORS

mongoc_database_command()

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

mongoc_database_command_simple()

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

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.