.\" 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_COLLECTION_COMMAND" "3" "Oct 20, 2022" "1.23.1" "libmongoc"
.SH NAME
mongoc_collection_command \- mongoc_collection_command()
.SH SYNOPSIS
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
mongoc_cursor_t *
mongoc_collection_command (mongoc_collection_t *collection,
                           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;
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
This function is superseded by \fI\%mongoc_collection_command_with_opts()\fP, \fI\%mongoc_collection_read_command_with_opts()\fP, \fI\%mongoc_collection_write_command_with_opts()\fP, and \fI\%mongoc_collection_read_write_command_with_opts()\fP\&.
.sp
This function is not considered a retryable read operation.
.SH PARAMETERS
.INDENT 0.0
.IP \(bu 2
\fBcollection\fP: A \fI\%mongoc_collection_t\fP\&.
.IP \(bu 2
\fBflags\fP: A \fI\%mongoc_query_flags_t\fP\&.
.IP \(bu 2
\fBskip\fP: A uint32_t with the number of documents to skip or zero.
.IP \(bu 2
\fBlimit\fP: A uint32_t with the max number of documents to return or zero.
.IP \(bu 2
\fBbatch_size\fP: A uint32_t with the number of documents in each batch or zero. Default is 100.
.IP \(bu 2
\fBcommand\fP: A \fI\%bson_t\fP containing the command to execute.
.IP \(bu 2
\fBfields\fP: A \fI\%bson_t\fP containing the fields to return or \fBNULL\fP\&. Not all commands support this option.
.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.
.