Upgrading
This version is source compatible with the 1.1.0 version of the driver.
It is recommended that users recompile against the new driver as methods have moved supporting pluggable authentication and the MongoIterator/MongoCursorControl additions.
Updates and Improvements:
MongoDB 2.4 Support
- Pluggable authentication support and the addition of Kerberos authentication. See the user's guide on Kerberos for more information.
- Add support for creating text indexes and creating Text commands/queries.
- Note: 10gen has stated that the Full Text Search capability is experimental. Furthermore, use of the feature is not advised for production deployments. For this reason we have not added the Text helper and Text.Builder to the drivers API, e.g., they may change. We feel it is important to still include the helper classes in the driver to maximize testing, experimentation, and feedback.
- Add support for creating 2dshere indexes.
- Add support for creating geoHaystack indexes.
- Add support for creating GeoJSON documents and using GeoJSON documents with $near, $within, $geoIntersects, and $geoWithin query operators.
- Support for the Aggregation's $geoNear operator.
- Support for the Aggregation's $concat expression.
Cursor Restarts
- Added the ability to persist and restart fetching the results of a query from either a MongoIterator or stream. See the user's guide on cursor restarts for more information.
Builder Usability
- All of the various command Builders have been updated to support a fluent usage style and be creatable from a static builder() method of the command's class. As an example of the new syntax consider:
Date hourAgo = new Date(System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1));
Find find = Find.builder()
.query(where("timeStamp").lessThan(hourAgo))
.sort(Sort.asc("timeStamp"))
.limit(100)
.batchSize(10)
.build();
Miscellaneous
- Extend the Json class to parse strict formated extended JSON as specified in the MongoDB Extended JSON documentation.
- Add the getValueAsObject() and getValueAsString() methods to the Element interface to make type accessing the value of an Element in a type agnostic way possible.
- Update the MongoCollection methods to support passing the various command Builders instead of the commands themselves.
- Update the ObjectId to enable construction from a HEX string.
- Added Spring XML namespace configuration support to the extensions jar.
Semantic Change
- Previously, a closed MongoClient could be "reopened" simply by continuing to use it. This could cause race conditions with applications that did not correctly close down. To avoid these issues we have modified the MongoClient.close() method to permanently close the client and throw the MongoClientClosedException on any attempt to send a message after the MongoClient is closed.
Deprecations
The following classes have been deprecated:
The following methods have been deprecated:
- Sort.geo2d(String) has been replaced by the Index.geo2d(String) method.
- MongoClientConfiguration.authenticate(String, String), MongoClientConfiguration.authenticateAsAdmin(String, String), MongoClientConfiguration.getDefaultDatabase(), MongoClientConfiguration.getUserName(), MongoClientConfiguration.getPasswordHash(), MongoClientConfiguration.isAdminUser(), and MongoClientConfiguration.setDefaultDatabase(String) have all been deprecated. Use the Credential class and MongoClientConfiguration.addCredential(Credential) instead.
- MongoCollection.streamingFind(Callback, DocumentAssignable), and MongoCollection.streamingFind(Callback, Find) have been replaced with versions that accept the new StreamCallback interface.