.\" This manpage is Copyright (C) 2016 MongoDB, Inc. .\" .\" Permission is granted to copy, distribute and/or modify this document .\" under the terms of the GNU Free Documentation License, Version 1.3 .\" or any later version published by the Free Software Foundation; .\" with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. .\" A copy of the license is included in the section entitled "GNU .\" Free Documentation License". .\" .TH "MONGOC_CURSOR_NEW_FROM_COMMAND_REPLY" "3" "2016\(hy10\(hy12" "MongoDB C Driver" .SH NAME mongoc_cursor_new_from_command_reply() \- Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command: .SH "SYNOPSIS" .nf .nf mongoc_cursor_t * mongoc_cursor_new_from_command_reply (mongoc_client_t *client, bson_t *reply, uint32_t server_id); .fi .fi .SH "PARAMETERS" .TP .B client A .B mongoc_client_t . .LP .TP .B reply The reply to a command, such as "aggregate", "find", or "listCollections", that returns a cursor document. The reply is destroyed by .B mongoc_cursor_new_from_command_reply and must not be accessed afterward. .LP .TP .B server_id The opaque id of the server used to execute the command. .LP .SH "DESCRIPTION" Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command: .B { "aggregate" : "collection", "pipeline" : [], "cursor" : {}} The server replies: .nf { "cursor" : { "id" : 1234, "ns" : "db.collection", "firstBatch" : [ ] }, "ok" : 1 } .fi .B mongoc_cursor_new_from_command_reply is a low\(hylevel function that initializes a .B mongoc_cursor_t from such a reply. Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher\(hylevel functions such as .B mongoc_collection_aggregate are more appropriate, and ensure compatibility with a range of MongoDB versions. .SH "RETURNS" A .B mongoc_cursor_t . On failure, the cursor's error is set. Check for failure with .B mongoc_cursor_error . .B .SH COLOPHON This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.