-
Notifications
You must be signed in to change notification settings - Fork 545
Tutorial
Tyler Brock edited this page Apr 17, 2014
·
41 revisions
#include "mongo/bson/bson.h"
#include "mongo/client/dbclient.h"
using namespace mongo;
DBClientConnection conn;
conn.connect("localhost");
ScopedDbConnection conn("localhost");
// The scoped connection can be used like a pointer to a connection
conn->query();
// etc
// When finished with the connection you must call done
conn.done();
#### Inserting a Document
```cpp
conn.insert(
"test.test",
BSON(
"name" << "Tyler" <<
"age" << 29 <<
"awesome" << true
)
);