[GODRIVER-265] Implement Stringer for objectid.ObjectID Created: 28/Feb/18  Updated: 28/Oct/23  Resolved: 05/Mar/18

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

Type: New Feature Priority: Trivial - P5
Reporter: Christopher Hunter Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I was playing around with the driver and noticed when I print an ObjectID, an array of bytes is printed (ex: [90 150 78 63 112 202 150 82 152 208 62 199]).
As my first "contribution" I thought I would like to implement the Stringer interface for this type.
The string method will return a string with something like: ObjectId("5a964bd0939f8aaf8d729fc6").

I thought I would start with something simple to learn your contribution process.



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

Author:

{'email': 'hunter.christopher@icloud.com', 'name': 'crhntr', 'username': 'crhntr'}

Message: GODRIVER-265 Implemented Stringer for ObjectID

Change-Id: I7d5f91d30b6b05664246f1a8ba4e47fee55a65cb
Signed-off-by: Kris Brandow <kris@mongodb.com>
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/4729432b3911b4c320ef2ebc9301f6c838b41073

Comment by Kristofer Brandow (Inactive) [ 02/Mar/18 ]

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

Comment by Christopher Hunter [ 28/Feb/18 ]

I just noticed that we call go type "ObjectID" and the value printed in the mongo shell is "ObjectId," note the lower case character 'd'

I decided to go with the value printed in the shell, although in general, I feel ObjectID reads better.

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