[JAVA-1258] Introduce closed type system for BSON documents Created: 29/May/14  Updated: 31/Mar/15  Resolved: 19/Jun/14

Status: Closed
Project: Java Driver
Component/s: API, BSON
Affects Version/s: None
Fix Version/s: 3.0.0

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change

 Description   

Introduce a closed type system for BSON documents and use it pervasively in the core of the driver, in preference to the open-typed Document class that is used now.

Introduce a BsonDocumentReader implementation of BsonReader and a BsonDocument implementation of BsonWriter. This allows for easy conversion from any type with a Codec to and from a BsonDocument.

This also means that clients of the core driver don't have to pass a separate encoder/decoder to operations that take or receive BsonDocument instances, as operations can just use the built-in BsonDocument Codec (which does not need to be extensible since the type system is closed)

To handle the case where a client wants to pass an object to an operation without paying the cost of converting to BsonDocument, provide a BsonDocumentWrapper sub-class of BsonDocument that is constructed with an instance of T and an Encoder<T>. When the operation serializes it to the wire, it will just use that Encoder to do it.



 Comments   
Comment by Jeffrey Yemin [ 31/Mar/15 ]

Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.

Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Created BsonDocumentReader class that supports a BsonDocument as the source of a BSONReader.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/cb8f1eabe117c0503c0af6430ddb179136b88e09

Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Changed BSONReader and BSONWriter to interfaces, and added AbstractBSONReader and AbstractBSONWriter. Refactored AbstractBSONReader to pull more behavior up, to make it easier to write subclasses.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/0aaf4dcfa9b7a320fd5fc88ed4c8440d51432dbd

Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added BsonDocumentWriter, a BsonWriter whose sink is a BsonDocument
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/ced5b54f04bc108d06dd57dac0ae04970998477e

Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added support for a closed type system for BSON, which among other things includes a type-safe BsonDocument class as well as a BsonDocumentCodec. Introduce a BsonValue base class for all BSON types, and added ones that were missing, most notably BsonDocument, BsonArray, and the missing primitives like BsonInt32, BsonInt64, BsonBoolean, etc.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/6fb1830a3dd42997efc4ed8068ec267c20a247be

Comment by Githook User [ 13/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Created BsonDocumentReader class that supports a BsonDocument as the source of a BSONReader.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/cb8f1eabe117c0503c0af6430ddb179136b88e09

Comment by Githook User [ 13/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Changed BSONReader and BSONWriter to interfaces, and added AbstractBSONReader and AbstractBSONWriter. Refactored AbstractBSONReader to pull more behavior up, to make it easier to write subclasses.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/0aaf4dcfa9b7a320fd5fc88ed4c8440d51432dbd

Comment by Githook User [ 13/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added BsonDocumentWriter, a BsonWriter whose sink is a BsonDocument
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/ced5b54f04bc108d06dd57dac0ae04970998477e

Comment by Githook User [ 13/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added support for a closed type system for BSON, which among other things includes a type-safe BsonDocument class as well as a BsonDocumentCodec. Introduce a BsonValue base class for all BSON types, and added ones that were missing, most notably BsonDocument, BsonArray, and the missing primitives like BsonInt32, BsonInt64, BsonBoolean, etc.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/6fb1830a3dd42997efc4ed8068ec267c20a247be

Comment by Githook User [ 11/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Created BsonDocumentReader class that supports a BsonDocument as the source of a BSONReader.
Branch: rozza/codecs-bson-rename-ontop
https://github.com/mongodb/mongo-java-driver/commit/b3e964a6bef80dd90c527e43e1c0c7efc100c5cd

Comment by Githook User [ 11/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Changed BSONReader and BSONWriter to interfaces, and added AbstractBSONReader and AbstractBSONWriter. Refactored AbstractBSONReader to pull more behavior up, to make it easier to write subclasses.
Branch: rozza/codecs-bson-rename-ontop
https://github.com/mongodb/mongo-java-driver/commit/3d6aa6fe5a1c5ec665adc9e10e4de13ba5b3d446

Comment by Githook User [ 11/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added BsonDocumentWriter, a BsonWriter whose sink is a BsonDocument
Branch: rozza/codecs-bson-rename-ontop
https://github.com/mongodb/mongo-java-driver/commit/edeb99a620eb26a41904ac12e446b269a96bf8dc

Comment by Githook User [ 11/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added support for a closed type system for BSON, which among other things includes a type-safe BsonDocument class as well as a BsonDocumentCodec. Introduce a BsonValue base class for all BSON types, and added ones that were missing, most notably BsonDocument, BsonArray, and the missing primitives like BsonInt32, BsonInt64, BsonBoolean, etc.
Branch: rozza/codecs-bson-rename-ontop
https://github.com/mongodb/mongo-java-driver/commit/b97942ec7943924dc011112acc4657481c3904c2

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Created BsonDocumentReader class that supports a BsonDocument as the source of a BSONReader.
Branch: codecs-bson-rename
https://github.com/mongodb/mongo-java-driver/commit/50877b1dadfbd35e08dcfd57ee0a18d2e5fc8e66

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Changed BSONReader and BSONWriter to interfaces, and added AbstractBSONReader and AbstractBSONWriter. Refactored AbstractBSONReader to pull more behavior up, to make it easier to write subclasses.
Branch: codecs-bson-rename
https://github.com/mongodb/mongo-java-driver/commit/2a10d35e9569a101addae51a88dd347edd42edc1

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added BsonDocumentWriter, a BsonWriter whose sink is a BsonDocument
Branch: codecs-bson-rename
https://github.com/mongodb/mongo-java-driver/commit/bfea940e23e35f4ae359c31ecea5d5e3559a723d

Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-1258: Added support for a closed type system for BSON, which among other things includes a type-safe BsonDocument class as well as a BsonDocumentCodec. Introduce a BsonValue base class for all BSON types, and added ones that were missing, most notably BsonDocument, BsonArray, and the missing primitives like BsonInt32, BsonInt64, BsonBoolean, etc.
Branch: codecs-bson-rename
https://github.com/mongodb/mongo-java-driver/commit/2ddbbd0450ca4a46200d75eda36c4aa99d2551d9

Generated at Thu Feb 08 08:54:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.