.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MONGOC_DATABASE_COMMAND" "3" "May 07, 2024" "1.27.1" "libmongoc" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX 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) BSON_GNUC_WARN_UNUSED_RESULT; .EE .UNINDENT .UNINDENT .sp This function is superseded by \fI\%mongoc_database_command_with_opts()\fP, \fI\%mongoc_database_read_command_with_opts()\fP, \fI\%mongoc_database_write_command_with_opts()\fP, and \fI\%mongoc_database_read_write_command_with_opts()\fP\&. .SH DESCRIPTION .sp This function creates a cursor which will execute the command when \fI\%mongoc_cursor_next()\fP is called on it. The database\(aqs read preference, read concern, and write concern are not applied to the command, and \fI\%mongoc_cursor_next()\fP will not check the server response for a write concern error or write concern timeout. .sp This function is not considered a retryable read operation. .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBdatabase\fP: A \fI\%mongoc_database_t\fP\&. .IP \(bu 2 \fBflags\fP: A \fI\%mongoc_query_flags_t\fP\&. .IP \(bu 2 \fBskip\fP: The number of documents to skip on the server. .IP \(bu 2 \fBlimit\fP: The maximum number of documents to return from the cursor. .IP \(bu 2 \fBbatch_size\fP: Attempt to batch results from the server in groups of \fBbatch_size\fP documents. .IP \(bu 2 \fBcommand\fP: A \fI\%bson_t\fP containing the command. .IP \(bu 2 \fBfields\fP: An optional \fI\%bson_t\fP containing the fields to return. \fBNULL\fP for all fields. .IP \(bu 2 \fBread_prefs\fP: An optional \fI\%mongoc_read_prefs_t\fP\&. Otherwise, the command uses mode \fBMONGOC_READ_PRIMARY\fP\&. .UNINDENT .SH RETURNS .sp This function returns a newly allocated \fI\%mongoc_cursor_t\fP that should be freed with \fI\%mongoc_cursor_destroy()\fP when no longer in use. The returned \fI\%mongoc_cursor_t\fP is never \fBNULL\fP, even on error. The user must call \fI\%mongoc_cursor_next()\fP on the returned \fI\%mongoc_cursor_t\fP to execute the initial command. .sp Cursor errors can be checked with \fI\%mongoc_cursor_error_document()\fP\&. It always fills out the \fI\%bson_error_t\fP if an error occurred, and optionally includes a server reply document if the error occurred server\-side. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 Failure to handle the result of this function is a programming error. .UNINDENT .UNINDENT .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .