[GODRIVER-1819] BSON encoding, passing single string to $addToSet field Created: 04/Jan/21  Updated: 06/Jan/21  Resolved: 06/Jan/21

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

Type: Bug Priority: Major - P3
Reporter: Andrew Hodel Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux


Issue Links:
Cloners
is cloned by GODRIVER-1820 CLONE - BSON encoding, passing single... Closed
Related
is related to GODRIVER-1818 BSON encoding, passing single string ... Closed

 Description   
update := bson.D {| | | |                                 \{"$set", f}

,

 
                                 {"$addToSet", bson.E{"outsideIp", "string"}},
 
}
 
 
 
updateResult, err := collection.UpdateOne(context.TODO(), filter, update)

 

This fails.

 

There is another bug posted here which was closed by a person that provides code to use a string, then when an error saying you need an array shows up he says you need to use an array.

 

https://jira.mongodb.org/browse/GODRIVER-1818

 

That's not how programming languages work.

 



 Comments   
Comment by Andrew Hodel [ 04/Jan/21 ]

This is a problem between the nodejs driver and the go driver, why would they be different when the company mongo is making them?

 

The nodejs driver will replace the field in the document, the go driver will not.

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