[GODRIVER-413] Implement Improved BSON Design Created: 09/May/18  Updated: 21/Dec/18  Resolved: 14/Nov/18

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

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Kristofer Brandow (Inactive)
Resolution: Done Votes: 0
Labels: beta, biconnector
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on GODRIVER-494 BSON Codec Redesign Closed
depends on GODRIVER-610 Scope & Design Improved BSON Support Closed
is depended on by GODRIVER-580 Need to be able to unmarshall to bson... Closed
is depended on by GODRIVER-634 Add benchmarks for D, Doc, and Raw BS... Closed
Duplicate
is duplicated by GODRIVER-338 Support all BSON types in mgobson Closed
Related
related to GODRIVER-592 Reverse Dependencies of bson and bson... Closed
related to GODRIVER-613 Add bsoncore Builder types Closed
is related to GODRIVER-632 Add As* methods to bsoncore.Value, bs... Closed

 Description   

Implement the improved BSON design for the Go driver. This includes an easy path for users to upgrade from mgo/bson to mongo-go-driver/bson.



 Comments   
Comment by Kristofer Brandow (Inactive) [ 14/Nov/18 ]

Code Reviews: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/431549 and https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/433195.

Comment by Githook User [ 14/Nov/18 ]

Author:

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

Message: Redesign Document, Array, Element, and Value types

Migration Notes:
The Document, Element, Value, and Array types have been redesign and
rewritten. They have been renamed Doc, Elem, Val, and Arr respectively.
And additional type, MDoc, has been created.

The Value type no longer stores values as a slice of bytes,
instead opting for a compact 32byte representation that stores values
closer to native Go types. An empty Value is equivalent to a BSON Null.
All of the methods in this package will treat Value{} and
bson.Null() as the same.

The Element type is much simpler and adds a key to a Value.

The Document and Array types have been simplified, removing many of
their methods, and making them conceptually two different types, instead
of building an Array on top of a Document. Their methods have also been
updated to handle easier usage of Element and Value instances.

The constructors have been removed and replaced with a simpler
construction system that uses functions. There is a symmetry between
these functions and the methods on the Value type. The input to the
constructor matches the output of the Value method, for example this is
valid: bson.Double(val.Double()).

The BSON primitive types have been moved from the bson package to a new
package called primitive. The types that were (briefly) called
Primitive are now call primitive., e.g.
RegexPrimitive->primitive.Regex.

The Doc and MDoc types are functionally equivalents of D and M, but with
much higher type safety. Because Doc, MDoc, Arr, Elem, and Val form a
closed systems, and because it's not possible to create an invalid Val
type, Doc, MDoc, and Arr never return errors when Marshaling to BSON.
Both Doc and MDoc have depth traversal capabilities, so looking up a key
thats several subdocuments deep can be done with a single method call,
and in the case of MDoc can be done so in a higher performance manner.

When migrating from Document to Doc, users should ensure they reassign
the return of Append, Prepend, and Set to the doc. With Document, one
could call Append and it would modify the original document, the new Doc
type does not operate in this manner and operates similar to a regular
slice.

GODRIVER-413
GODRIVER-610

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

Comment by Githook User [ 31/Oct/18 ]

Author:

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

Message: Add BSON Proxy support

GODRIVER-413

Change-Id: I600841a34012adc3d3b95272bf36008212453576
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/745f04e02316fafe9e453005dd0095bdda3ce2b8

Comment by David Dana [ 19/Oct/18 ]

Do y'all have a way us downstream folks can see what set of tickets comprises the version of the GODRIVER you're aiming to ship in December to support Cloud?

Comment by Jeffrey Yemin [ 18/May/18 ]

CC kris.brandow.  I don't have any more details to add than what's in the description, but I think it makes sense to wait until after the encoder/decoder work in the main driver is completed before we start on this.

 

Comment by Sam Kleinman (Inactive) [ 18/May/18 ]

Would it possible to outline the work that you envision for this ticket? Is there a list of requirements or expectations that exist somewhere for this?

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