.\" Man page generated from reStructuredText. . .TH "MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY" "3" "Jun 04, 2021" "1.17.6" "libmongoc" .SH NAME mongoc_cursor_new_from_command_reply \- mongoc_cursor_new_from_command_reply() . .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 .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C mongoc_cursor_t * mongoc_cursor_new_from_command_reply (mongoc_client_t *client, bson_t *reply, uint32_t server_id); BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts); .ft P .fi .UNINDENT .UNINDENT .SH DEPRECATED .sp This function is deprecated and should not be used in new code. .sp Please use \fBmongoc_cursor_new_from_command_reply_with_opts()\fP instead. .sp When migrating from the deprecated \fBmongoc_cursor_new_from_command_reply()\fP to \fBmongoc_cursor_new_from_command_reply_with_opts()\fP, note that options previously passed to the \fBreply\fP argument (e.g. "batchSize") must instead be provided in the \fBopts\fP argument. .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBclient\fP: A \fBmongoc_client_t\fP\&. .IP \(bu 2 \fBreply\fP: The reply to a command, such as "aggregate", "find", or "listCollections", that returns a cursor document. The reply is destroyed by \fBmongoc_cursor_new_from_command_reply\fP and must not be accessed afterward. .IP \(bu 2 \fBserver_id\fP: The opaque id of the server used to execute the command. .UNINDENT .SH DESCRIPTION .sp Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C { "aggregate" : "collection", "pipeline" : [], "cursor" : {}} .ft P .fi .UNINDENT .UNINDENT .sp The server replies: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C { "cursor" : { "id" : 1234, "ns" : "db.collection", "firstBatch" : [ ] }, "ok" : 1 } .ft P .fi .UNINDENT .UNINDENT .sp \fBmongoc_cursor_new_from_command_reply\fP is a low\-level function that initializes a \fBmongoc_cursor_t\fP from such a reply. Additional options such as "tailable" or "awaitData" can be included in the reply. .sp When synthesizing a completed cursor response that has no more batches (i.e. with cursor id 0), set \fBserver_id\fP to 0 as well. .sp Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher\-level functions such as \fBmongoc_collection_aggregate\fP are more appropriate, and ensure compatibility with a range of MongoDB versions. .SH RETURNS .sp A \fBmongoc_cursor_t\fP\&. On failure, the cursor\(aqs error is set. Check for failure with \fBmongoc_cursor_error\fP\&. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .