[GODRIVER-339] Document Set does not always replace the correct field. Created: 04/Apr/18  Updated: 28/Oct/23  Resolved: 05/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: Thomas Delacour (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends

 Description   

It's possible to use the Document.Set function and get a resulting document with the wrong field replaced. After discussion with kris.brandow it seems like the problem is this line:

https://github.com/mongodb/mongo-go-driver/blob/master/bson/document.go#L259

which should be replaced with d.elems[d.index[i]] = elem



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

Author:

{'email': 'kris@mongodb.com', 'name': 'Kris Brandow', 'username': 'skriptble'}

Message: Fix bug with bson.Document.Set

Fixes a bug with bson.Document.Set where documents that are not in
lexicographical order would have elements incorrectly replaced.

GODRIVER-339

Change-Id: I37f1415ba10196121229b117f44b1eeb97e0a200
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/f172d2723583a272b0b928134b79f5551e3129f5

Comment by Kristofer Brandow (Inactive) [ 04/Apr/18 ]

Code Review: https://review.gerrithub.io/c/406467/.

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