File: mongoc_database_t.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 (58 lines) | stat: -rw-r--r-- 2,141 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
53
54
55
56
57
58
<?xml version="1.0"?>

<page id="mongoc_database_t"
      type="guide"
      style="class"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/">
  <info>
    <link type="guide" xref="index#api-reference" />
  </info>

  <title>mongoc_database_t</title>
  <subtitle>MongoDB Database Abstraction</subtitle>

  <section id="description">
    <title>Synopsis</title>
    <screen><code mime="text/x-csrc"><![CDATA[typedef struct _mongoc_database_t mongoc_database_t;]]></code></screen>
    <p><code>mongoc_database_t</code> provides access to a MongoDB database. This handle is useful for actions a particular database object. It <em>is not</em> a container for <code xref="mongoc_collection_t">mongoc_collection_t</code> structures.</p>
    <p>Read preferences and write concerns are inherited from the parent client. They can be overridden with <code xref="mongoc_database_set_read_prefs">mongoc_database_set_read_prefs()</code> and <code xref="mongoc_database_set_write_concern">mongoc_database_set_write_concern()</code>.</p>
    <note style="warning"><p>It is an error to call <code
    xref="mongoc_database_destroy">mongoc_database_destroy()</code> on a
    database that has operations pending. It is required that you release <code
    xref="mongoc_cursor_t">mongoc_cursor_t</code> structures before calling
    <code xref="mongoc_database_destroy">mongoc_database_destroy</code>.
    </p></note>
  </section>

  <links type="topic" groups="function" style="2column">
    <title>Functions</title>
  </links>

  <section id="examples">
    <title>Examples</title>
    <screen><code mime="text/x-csrc"><![CDATA[#include <mongoc.h>

int
main (int argc,
      char *argv[])
{
   mongoc_database_t *database;
   mongoc_client_t *client;

   mongoc_init ();

   client = mongoc_client_new ("mongodb://localhost/");
   database = mongoc_client_get_database (client, "test");

   mongoc_database_destroy (database);
   mongoc_client_destroy (client);

   mongoc_cleanup ();

   return 0;
}
]]></code></screen>
  </section>
</page>