[JAVA-3885] Add a toBsonDocument() method without parameters to Bson Interface Created: 06/Nov/20  Updated: 28/Oct/23  Resolved: 20/Nov/20

Status: Closed
Project: Java Driver
Component/s: Builders
Affects Version/s: None
Fix Version/s: 4.2.0

Type: Improvement Priority: Major - P3
Reporter: Kai Orend Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change

 Description   

Allow to convert a Bson into a BsonDocument without having to provide any parameters.

This could present minor backwards compatibility issues for any class that implements Bson and already defines a toBsonDocument() method whose behavior is incompatible with the one now defined in Bson



 Comments   
Comment by Githook User [ 19/Nov/20 ]

Author:

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

Message: Add Bson#toBsonDocument() overload with a default implementation (#611)

  • Add oBsonDocument() overload with a default implementation to Bson interface
  • The default implementation simply calls toBsonDocument(Class<T>, CodecRegistry)
  • The Scala Document wrapper's existing toBsonDocument() method has been updated to
    override this method and return the underlying `BsonDocument` instead of returning a copy.

JAVA-3885
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/6d20b9128bd6966b31c23f7aab681c056aaefc72

Generated at Thu Feb 08 09:00:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.