- legacy (v1)
- Breaking changes from 26compat
Breaking changes from 26compatThe Legacy C++ driver has reached End-Of-Life. Please upgrade to the mongocxx driver.
The 26compat release series tracks the server 2.6 releases one-to-one. As a result, it receives only bugfixes and small updates necessary to keep it building in isolation.
The legacy release series, on the other hand, is a permanent and diverging fork. Our philosophy is to keep the legacy branch as close to the 26compat branch as is reasonable, but that when weighing new features against compatibility, we will choose new features. As a result the legacy branch is not 100% source compatible with the 26compat branch.
This page attempts to serve as a transition guide for those users looking to migrate from the 26compat branch to the legacy branch. Note that it does not discuss new features in detail and simply points to the per-release notes.
Changes to the build system
Scons targets have been renamed to more ‘obvious’ names, and some unused or unneeded targets have been removed.
|check driver install (used internally)||
|build unit tests||
|run unit tests||
|build integration tests||
|run integration tests||
|build client examples||
|run client examples||
|build everything (driver, unit tests, integration tests, examples||
|run all tests and client examples||
mongo-orchestrationis now required to run the driver’s test suite. Please see the repository for instructions how to install and run
mongo-orchestration. If you are not running tests, simply allow scons to time out when it looks for an instance of
mongo-orchestrationat the start of a build.
drivertarget has been created to built the client library without installing it
install-mongoclienttarget has been renamed to
- Unit tests are now built with
build-unit, and run with
- Integration tests are now built with
build-integration, and run with
- Examples are now built with
build-examples, and run with
- On OSX the
--osx-version-minflag will now default to the current OSX version
--fullflag is no longer required, and it is an error to specify it.
--ddflags have been removed. Use the
--use-system-boostflag is no longer required, and it is an error to specify it.
- All ABI affecting macros are now defined in a generated
config.hheader that is automatically included from
- Many server specific build options (that were unlikely to have been used when building the driver) have been removed.
- The default installation prefix is now
build/install, rather than
- All build artifacts are now captured under the
Changes to APIs
mongo::BSONObjBuilderhave been removed. We recommend using the fully qualified names in new code.
mongo::BSONBuilderBaseclass has been removed and is no longer a base class of
OpTimeclass has been completely removed. It has been replaced by the simplified
globalSSLOptionsobjects and their classes have been removed. All driver configuration should be done through the new
Consoleclasses have been removed from the logging subsystem.
- In addition, many auxiliary types, functions, and headers that were either unused, or minimally used, have been removed from the distribution.
ensureIndexand related methods have been removed. The replacement is the new
IndexSpec::dropDuplicates()is now deprecated as it is a no-op in MongoDB 3.0.
QUERYmacro has been replaced by
ConnectionString::parsemethod now requires it’s argument to be in the MongoDB URL (“mongodb://…“) format. To use the old format, use the new
ScopedDbConnectionclasses have been removed.
- The driver will not function correctly unless
mongo::client::initializeis invoked before using the driver APIs. The mongo::client::shutdown method should also be called at application termination (if options.callShutdownAtExit() is not set) so the driver can cleanly terminate. As a convenience, we have added
mongo::GlobalInstanceas an RAII wrapper to automatically call these methods.
- options.callShutdownAtExit() is a no-op on non-static builds on Windows due to issues around sudden thread termination.
- The driver no longer logs any output by default. You may configure and inject a logger to re-enable logging. See
src/mongo/client/examples/clientTest.cppfor an example of how to enable logging.
- Writes are now “acknowledged” by default. In all previous releases the default write concern was “unacknowledged”. This change may have performance and behavior implications for existing applications that did not confirm writes. You can read more about the change here.
- The driver now throws a mongo::OperationException when write concern is greater than Acknowledged for errors that occur when running operations against a MongoDB database.
- The default shutdown grace period is now zero which means the driver may block forever until a successful shutdown occurs.
Please see the release notes for the individual legacy branch releases for details on improvements in each release.