[GODRIVER-882] Add multi-word type aliases to BSON types Created: 18/Mar/19  Updated: 18/Mar/19  Resolved: 18/Mar/19

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

Type: Improvement Priority: Minor - P4
Reporter: Ben Moskovitz Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The types for BSON are pretty hard to parse, especially for newbies - a type called M doesn't make clear that it's actually a map without reading the docs first.

I've created at PR: https://github.com/mongodb/mongo-go-driver/pull/143 that adds these aliases - ie bson.Map for what is currently bson.M, and updates the bson documentation to reflect these changes, preferring the fullword aliases over the single letter ones, but acknowledging the single letter ones as  well.



 Comments   
Comment by Ben Moskovitz [ 18/Mar/19 ]

I agree that the existing names make sense for users switching from mgo, and that the single-letter type names use less space, however the attached PR doesn't change any compatibility - they're aliases, so bson.M will work just as well as bson.Map, users will just have the choice to use them if they like.

 

Comment by Scott L'Hommedieu (Inactive) [ 18/Mar/19 ]

We understand this can be a factor in approaching the go driver for the first time.  However, for historical reasons (mgo) the existing names of these types is quite convenient.  Also, to prevent the verbosity of constructing large documents with the full type name the abbreviated versions are preferred.

We'll close this now and if anyone feels very strongly or has further evidence we can reopen.  We will also reconsider this in the future when this driver is used extensively by both folks migrating from mgo and newcomers to go+mongodb.

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