diff options
| author | Apollon Oikonomopoulos <apoikos@debian.org> | 2016-01-14 00:10:06 +0200 |
|---|---|---|
| committer | Apollon Oikonomopoulos <apollon@skroutz.gr> | 2016-01-14 00:10:06 +0200 |
| commit | 374e1947abcd3e127a2a613aff73ecffdb9199ea (patch) | |
| tree | d83973c3c9802450acd5b5e86fe0d4e8e60a3a1b /src/mongo/client/examples/first.cpp | |
| parent | 65585c90b12d6523bea75a2aebaae2a2fdf9e641 (diff) | |
Imported Upstream version 2.6.11upstream/2.6.11
Diffstat (limited to 'src/mongo/client/examples/first.cpp')
| -rw-r--r-- | src/mongo/client/examples/first.cpp | 9 |
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; } |
