[GODRIVER-1190] bson Unmarshal MapEncodeValue can only encode valid map[string]*, but got map[int]interface {} Created: 05/Jul/19  Updated: 16/Nov/21  Resolved: 07/Aug/20

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

Type: Bug Priority: Major - P3
Reporter: Tiansheng Ren Assignee: Isabella Siu (Inactive)
Resolution: Done Votes: 0
Labels: mgocompat
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

type ts struct {
		Value map[int]string
	}
 
	instanceMap := map[string]interface{}{"value": map[int]interface{}{1: 12, 2: 122}}
	instanceByte, err := bson.Marshal(instanceMap)
	require.NoError(t, err)
 
	fmt.Println(fmt.Sprintf("%v", instanceByte))
	var newInstance ts
	err = bson.Unmarshal(instanceByte, &newInstance)
	require.NoError(t, err)



 Comments   
Comment by Isabella Siu (Inactive) [ 07/Aug/20 ]

Fixed as part of the mgocompat epic.

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