Detailed explanation of (BsonDocument & Document & Bson) relationship in MongoDB
Class Diagram:
There are several classes and interfaces in Java Driver to represent Bson documents:
Summarize:
- BsonDocument and Document are classes
- BsonDocument is more suitable for the underlying (internal) API, and the division of value types is finer and stricter
- Document has a wider division of value types and is more suitable for high-level APIs
- DBObject is an interface and requires a concrete class BasicDBObject to implement it