[JAVA-2707] Add new MongoClient interface that doesn't include the legacy API Created: 14/Dec/17 Updated: 28/Oct/23 Resolved: 17/Jan/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Jeffrey Yemin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | Java9 |
| Description |
|
The current MongoClient API for the synchronous driver is a class that resides in the com.mongodb package in the driver module. It includes entry points to both the standard CRUD API via the getDatabase method as well as the legacy CRUD API via the deprecated getDB method. This was a reasonable approach when the 3.0 driver was released because we imagined that applications would slowly shift from the legacy API to the standard API, DAO by DAO, and it made sense for all of them to share a single MongoClient instance in order to avoid the overhead of two connection pools, two SDAM monitors, etc. While this is still a valid use case, most new applications never touch the legacy API, and we don't even refer to it in the reference documentation. Furthermore, including both APIs in a single module means that we will be unable to create modular JAR files that work properly as Java 9 modules. That's because the Java 9 module system prohibits the same package from being included in multiple modules, and currently the Java driver has such a split of the com.mongodb package. The mongodb-driver-core JAR file contains foundational classes used within core, as well as the sync and async drivers, including
while the mongodb-driver JAR file contains core classes for the high-level synchronous driver API, including
However, the standard CRUD API is defined in the com.mongodb.client package, and includes interfaces such as:
The only thing missing is an entry point. To that end, I propose adding a new MongoClient interface to the com.mongodb.client package as an additional entry point to the standard CRUD |
| Comments |
| Comment by Githook User [ 17/Jan/18 ] |
|
Author: {'name': 'Jeff Yemin', 'email': 'jeff.yemin@10gen.com', 'username': 'jyemin'}Message: This will allow new applications to have no dependencies on the legacy API. |