Skip to content

Commit

Permalink
CDRIVER-1232 more links to libbson docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdavis committed May 18, 2016
1 parent ebbb535 commit cf53704
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion doc/mongoc_collection_get_last_error.page
Expand Up @@ -32,7 +32,7 @@ mongoc_collection_get_last_error (const mongoc_collection_t *collection);

<section id="return">
<title>Returns</title>
<p>A <code>bson_t</code> that should not be modified or <code>NULL</code>.</p>
<p>A <code xref="bson:bson_t">bson_t</code> that should not be modified or <code>NULL</code>.</p>
</section>

</page>
2 changes: 1 addition & 1 deletion doc/mongoc_collection_validate.page
Expand Up @@ -50,7 +50,7 @@ mongoc_collection_validate (mongoc_collection_t *collection,
<section id="return">
<title>Returns</title>
<p>true if successful, otherwise false and error is set.</p>
<p><code>reply</code> is always initialized and must be destroyed with <code>bson_destroy()</code>.</p>
<p><code>reply</code> is always initialized and must be destroyed with <code xref="bson:bson_destroy()">bson_destroy()</code>.</p>
</section>

</page>
5 changes: 5 additions & 0 deletions doc/mongoc_index.page
Expand Up @@ -3,6 +3,11 @@
id="index">
<title>MongoDB C Driver</title>
<subtitle>A Cross Platform MongoDB Client Library for C</subtitle>
<section id="introduction">
<title>Introduction</title>
<p>The MongoDB C Driver, also known as "libmongoc", is a library for using MongoDB from C applications, and for writing MongoDB drivers in higher-level languages.</p>
<p>It depends on <link xref="bson:index">libbson</link> to generate and parse BSON documents, the native data format of MongoDB.</p>
</section>

<section id="installation">
<title>Installation</title>
Expand Down
79 changes: 39 additions & 40 deletions doc/mongoc_tutorial.page
Expand Up @@ -158,7 +158,7 @@ C:\> connect
},
languages : [ "MATH-MATIC", "FLOW-MATIC", "COBOL" ],
degrees: [ { degree: "BA", school: "Vassar" }, { degree: "PhD", school: "Yale" } ]
}]]</code></screen>
}]]></code></screen>
<p>Use the following code:</p>
<screen><code><![CDATA[#include <bson.h>
Expand Down Expand Up @@ -249,7 +249,7 @@ main (int argc,
return 0;
}]]></code></screen>

<p>See the <link xref="bson:bson_t">libbson documentation</link> for all of the types that can be appended to a <code>bson_t</code>.</p>
<p>See the <link xref="bson:bson_t">libbson documentation</link> for all of the types that can be appended to a <code xref="bson:bson_t">bson_t</code>.</p>
</section>

<section id="bcon">
Expand Down Expand Up @@ -495,44 +495,43 @@ C:\> find
<listing>
<title><file>find-specific.c</file></title>
<synopsis><code mime="text/x-csrc"><![CDATA[#include <bson.h>
#include <mongoc.h>
#include <stdio.h>
int
main (int argc,
char *argv[])
{
mongoc_client_t *client;
mongoc_collection_t *collection;
mongoc_cursor_t *cursor;
const bson_t *doc;
bson_t *query;
char *str;
mongoc_init ();
client = mongoc_client_new ("mongodb://localhost:27017/");
collection = mongoc_client_get_collection (client, "mydb", "mycoll");
query = bson_new ();
BSON_APPEND_UTF8 (query, "hello", "world");
cursor = mongoc_collection_find (collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
while (mongoc_cursor_next (cursor, &doc)) {
str = bson_as_json (doc, NULL);
printf ("%s\n", str);
bson_free (str);
}
bson_destroy (query);
mongoc_cursor_destroy (cursor);
mongoc_collection_destroy (collection);
mongoc_client_destroy (client);
mongoc_cleanup ();
return 0;
}
]]></code></synopsis>
#include <mongoc.h>
#include <stdio.h>
int
main (int argc,
char *argv[])
{
mongoc_client_t *client;
mongoc_collection_t *collection;
mongoc_cursor_t *cursor;
const bson_t *doc;
bson_t *query;
char *str;
mongoc_init ();
client = mongoc_client_new ("mongodb://localhost:27017/");
collection = mongoc_client_get_collection (client, "mydb", "mycoll");
query = bson_new ();
BSON_APPEND_UTF8 (query, "hello", "world");
cursor = mongoc_collection_find (collection, MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
while (mongoc_cursor_next (cursor, &doc)) {
str = bson_as_json (doc, NULL);
printf ("%s\n", str);
bson_free (str);
}
bson_destroy (query);
mongoc_cursor_destroy (cursor);
mongoc_collection_destroy (collection);
mongoc_client_destroy (client);
mongoc_cleanup ();
return 0;
}]]></code></synopsis>
</listing>

<screen><output style="prompt">$ gcc -o find-specific find-specific.c $(pkg-config --cflags --libs libmongoc-1.0)
Expand Down

0 comments on commit cf53704

Please sign in to comment.