summaryrefslogtreecommitdiff
path: root/src/mongo/client/examples/first.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/client/examples/first.cpp')
-rw-r--r--src/mongo/client/examples/first.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/client/examples/first.cpp b/src/mongo/client/examples/first.cpp
index 1e8616a9fb2..d5537dcad25 100644
--- a/src/mongo/client/examples/first.cpp
+++ b/src/mongo/client/examples/first.cpp
@@ -49,6 +49,12 @@ int main( int argc, const char **argv ) {
port = argv[ 2 ];
}
+ mongo::Status status = mongo::client::initialize();
+ if ( !status.isOK() ) {
+ std::cout << "failed to initialize the client driver: " << status.toString() << endl;
+ return EXIT_FAILURE;
+ }
+
mongo::DBClientConnection conn;
string errmsg;
if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) {
@@ -67,7 +73,7 @@ int main( int argc, const char **argv ) {
{
mongo::BSONObjBuilder query;
- auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.obj() );
+ std::auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.obj() );
if (!cursor.get()) {
cout << "query failure" << endl;
return EXIT_FAILURE;
@@ -95,4 +101,5 @@ int main( int argc, const char **argv ) {
cout << res.isEmpty() << "\t" << res.jsonString() << endl;
}
+ return EXIT_SUCCESS;
}