MongoDB C++ Driver legacy-1.1.2
Loading...
Searching...
No Matches
Classes | Functions
mongo::client Namespace Reference

the MongoDB C++ driver namespace More...

Classes

class  GlobalInstance
 An RAII helper to simplify driver setup and teardown. More...
 
class  Options
 The Options structure is passed to mongo::client::initialize to configure various properties and configurations of the driver. More...
 

Functions

MONGO_CLIENT_API Status MONGO_CLIENT_FUNC initialize (const Options &options=Options())
 Initializes the client driver, possibly with custom options.
 
MONGO_CLIENT_API Status MONGO_CLIENT_FUNC shutdown ()
 Terminates the client driver.
 

Detailed Description

the MongoDB C++ driver namespace

Function Documentation

◆ initialize()

MONGO_CLIENT_API Status MONGO_CLIENT_FUNC mongo::client::initialize ( const Options options = Options())

Initializes the client driver, possibly with custom options.

See the Options class for details on the various fields.

initialize() MUST be called EXACTLY once after entering 'main' and before using the driver. Do not call initialize() before entering 'main' (i.e. from a static initializer), as it relies on all static initialization having been completed.

◆ shutdown()

MONGO_CLIENT_API Status MONGO_CLIENT_FUNC mongo::client::shutdown ( )

Terminates the client driver.

If the driver does not terminate within the currently configured grace period in the driver options, an 'ExceededTimeLimit' Status will be returned, in which case it is legal to retry 'shutdown'. Other non-OK status values do not admit retrying the operation. A permanent failure to terminate the driver should be logged, and it may be unsafe to exit the process by any mechanism which causes normal destruction of static objects.

Once the driver has been terminated, it cannot be initialized again.