[GODRIVER-1551] Allow BSON undefined to decode to Go types Created: 03/Apr/20 Updated: 28/Oct/23 Resolved: 08/Apr/20 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | BSON |
| Affects Version/s: | 1.3.1 |
| Fix Version/s: | 1.4.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | David Golden | Assignee: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
The driver already allows decoding BSON Null as an integer type and it should do the same for the BSON Undefined type. This caused an error in ADL because the shell's `db.stats()` command sends the `scale` parameter as BSON undefined, which was not coerced to an integer but failed decoding instead:
|
| Comments |
| Comment by Githook User [ 08/Apr/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |
| Comment by Divjot Arora (Inactive) [ 08/Apr/20 ] |
| Comment by Benjamin Flast [ 03/Apr/20 ] |
|
Yes, 1.4.0 should be fine. We expect db.stats() to be used more heavily through ADL when a new Atlas feature called Online Archive comes out, and that will be coming out at a similar time to 4.4 Server. |
| Comment by David Golden [ 03/Apr/20 ] |
|
I think 1.4.0 timeframe is fine. +benjamin.flast can comment further. The problem is that "db.stats()" apparently is a not-uncommon thing for people to run to see "what's in my database" and so it's a bad early user-experience. Fixing this in ADL would mean having to duplicate a lot of the driver's existing "convert X to int" code, so we'd rather see this fixed driver-side, where it seems to be mostly a matter of adding an extra case statement to the existing value decoders (plus tests). |
| Comment by Craig Wilson [ 03/Apr/20 ] |
|
Yeah... I don't really remember the context or which way I argued, but I do think this now a request we've received and is needed. The shell sends undefined, so, while deprecated, is still in use even by us. |
| Comment by Divjot Arora (Inactive) [ 03/Apr/20 ] |
|
I'm inclined to change this to a feature request. The work to allow BSON null values to decode into non-pointer types was done in CC craiggwilson You brought up the possibility of handling undefined in the original PR. Any thoughts here? |