[GODRIVER-2684] Deprecate "bson.D.Map" Created: 10/Dec/22  Updated: 28/Oct/23  Resolved: 05/Apr/23

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.12.0

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Matt Dale
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by GODRIVER-2617 Remove or un-export all currently dep... Closed
Related
related to GODRIVER-2606 Deprecate unused functionality in pre... Closed
is related to GODRIVER-2141 Add a recursive option to Map() Closed
Epic Link: Go Driver 2.0 Prep
Quarter: FY24Q1
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Using the bson.D.Map method often results in unexpected output because the method only shallow-converts the D to an M. Updating the method to recursively convert a D to an M requires a lot of reflection logic and would be a backward-breaking behavior change in Go Driver 1.x. The only use case for converting a D to an M that we have observed it to marshal the D to an intuitive JSON representation (i.e. key-value instead of an array of tuples). In Go Driver 2.0, encoding to the intuitive JSON representation will be supported natively (see GODRIVER-1765), so the Map method will have no known use cases.

Definition of done:

  • Deprecate bson.D.Map. Recommend that users marshal a bson.D as BSON and unmarshal it as a bson.M to achieve the same D-to-M conversion.


 Comments   
Comment by Githook User [ 05/Apr/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2684 Deprecate D.Map. (#1218)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/9d5a35f8bf0e3028ac42ca4dcb9037aab812b940

Comment by Matt Dale [ 03/Apr/23 ]

PR: https://github.com/mongodb/mongo-go-driver/pull/1218

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