summaryrefslogtreecommitdiff
path: root/client/examples/first.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-03-17 00:05:43 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-03-17 00:05:43 +0100
commit582fc32574a3b158c81e49cb00e6ae59205e66ba (patch)
treeac64a3243e0d2121709f685695247052858115c8 /client/examples/first.cpp
parent2761bffa96595ac1698d86bbc2e95ebb0d4d6e93 (diff)
downloadmongodb-582fc32574a3b158c81e49cb00e6ae59205e66ba.tar.gz
Imported Upstream version 1.8.0
Diffstat (limited to 'client/examples/first.cpp')
-rw-r--r--client/examples/first.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/client/examples/first.cpp b/client/examples/first.cpp
index f3b654f..ab5efb3 100644
--- a/client/examples/first.cpp
+++ b/client/examples/first.cpp
@@ -40,7 +40,7 @@ int main( int argc, const char **argv ) {
throw -12;
port = argv[ 2 ];
}
-
+
mongo::DBClientConnection conn;
string errmsg;
if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) {
@@ -48,14 +48,15 @@ int main( int argc, const char **argv ) {
throw -11;
}
- { // clean up old data from any previous tests
+ {
+ // clean up old data from any previous tests
mongo::BSONObjBuilder query;
conn.remove( "test.people" , query.obj() );
}
insert( conn , "eliot" , 15 );
insert( conn , "sara" , 23 );
-
+
{
mongo::BSONObjBuilder query;
auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.obj() );
@@ -66,14 +67,14 @@ int main( int argc, const char **argv ) {
}
}
-
+
{
mongo::BSONObjBuilder query;
query.append( "name" , "eliot" );
mongo::BSONObj res = conn.findOne( "test.people" , query.obj() );
cout << res.isEmpty() << "\t" << res.jsonString() << endl;
}
-
+
{
mongo::BSONObjBuilder query;
query.append( "name" , "asd" );