Skip to content

Tutorial

Tyler Brock edited this page Apr 15, 2014 · 41 revisions
#include "mongo/bson/bson.h"
#include "mongo/client/dbclient.h"

Making a Connection

using namespace mongo;
DBClientConnection conn;
conn.connect("localhost");

Inserting a Document

conn.insert(
    "test.test",
    BSON(
        "name" << "Tyler" <<
        "age" << 29 <<
        "awesome" << true
    )
);

Querying for a document

Updating a document

Removing a document

Clone this wiki locally