[GODRIVER-430] bson.Document.Delete and bson.Document.Prepend are subtly broken Created: 25/May/18  Updated: 28/Oct/23  Resolved: 30/May/18

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

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

Epic Link: GODRIVER BSON public API improvements

 Description   

The Delete and Prepend methods for bson.Document are broken. The Delete method does not reorder the index used to find a key, so when a document there is a chance that other documents cannot be deleted after. Prepend does not properly reindex the document, so when an item is prepended it is not given a proper entry into the sorted index.

To solve the Delete and Prepend method issues, do a complete reindex after these methods are called to ensure that the index is properly sorted.



 Comments   
Comment by Githook User [ 30/May/18 ]

Author:

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

Message: Fix Delete and Prepend methods to update index

Fixes the bson.Document.Delete and bson.Document.Prepend methods to
properly update the index when being called.
Fixes bson.Document.Prepend to set the index for the newly prepended
element to 0 instead of the last element.

GODRIVER-430

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

Comment by Kristofer Brandow (Inactive) [ 26/May/18 ]

Code Review: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/412578.

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