[GODRIVER-656] Cannot decode null into a string type with *string Created: 26/Nov/18  Updated: 26/Nov/18  Resolved: 26/Nov/18

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

Type: Bug Priority: Minor - P4
Reporter: matthew [X] Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

go version go1.10.4 darwin/amd64


Issue Links:
Duplicate
duplicates GODRIVER-535 Add support for pointers to reflect.K... Closed

 Description   

Hi, 

I get an error when I try and decode a document containing null values to a struct containing a string pointer.

type Data struct

{      CityName *string `json:"city_name,omitempty" bson:"city_name"` }

 

Error: 

cannot decode null into a string type

 

Of course I would avoid null, but the data coming out of Mongo is generated by another team in the company, and they have too many documents to change it. 


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