File: mongoc_cursor_new_from_command_reply.page

package info (click to toggle)
libmongoc 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,824 kB
  • ctags: 4,501
  • sloc: ansic: 57,956; makefile: 717; python: 502; sh: 54
file content (52 lines) | stat: -rw-r--r-- 2,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="mongoc_cursor_new_from_command_reply">
  <info>
    <link type="guide" xref="mongoc_cursor_t" group="function"/>
  </info>
  <title>mongoc_cursor_new_from_command_reply()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[mongoc_cursor_t *
mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
                                      bson_t          *reply,
                                      uint32_t         server_id);]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>client</p></td><td><p>A <code xref="mongoc_client_t">mongoc_client_t</code>.</p></td></tr>
      <tr><td><p>reply</p></td><td><p>The reply to a command, such as "aggregate", "find", or "listCollections", that returns a cursor document. The reply is destroyed by <code>mongoc_cursor_new_from_command_reply</code> and must not be accessed afterward.</p></td></tr>
      <tr><td><p>server_id</p></td><td><p>The opaque id of the server used to execute the command.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>Some MongoDB commands return a "cursor" document. For example, given an "aggregate" command:</p>
    <code>{ "aggregate" : "collection", "pipeline" : [], "cursor" : {}}</code>
    <p>The server replies:</p>
    <code>{
   "cursor" : {
   "id" : 1234,
   "ns" : "db.collection",
   "firstBatch" : [ ]
   },
   "ok" : 1
}</code>
    <p><code>mongoc_cursor_new_from_command_reply</code> is a low-level function that initializes a <code xref="mongoc_cursor_t">mongoc_cursor_t</code> from such a reply.</p>
    <p>Use this function only for building a language driver that wraps the C Driver. When writing applications in C, higher-level functions such as <code xref="mongoc_collection_aggregate">mongoc_collection_aggregate</code> are more appropriate, and ensure compatibility with a range of MongoDB versions.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A <code xref="mongoc_cursor_t">mongoc_cursor_t</code>. On failure, the cursor's error is set. Check for failure with <code xref="mongoc_cursor_error">mongoc_cursor_error</code>.</p>
  </section>

</page>