Skip to content

Conversation

@glossd
Copy link
Contributor

@glossd glossd commented Mar 14, 2021

Try to run this code

type Entity struct {
	ID primitive.ObjectID `bson:"_id"`
}

func main() {
	var e Entity
	err := bson.UnmarshalExtJSON([]byte(`{"_id":"5ef7fdd91c19e3222b41b839"}`), true, &e)
	if err != nil {
		log.Fatal(err)
	}
}

You'll get an ObjectID string must be exactly 12 bytes long. Obvious bug

@glossd glossd changed the title Add object id decoder awareness of string hex GODRIVER-1919 Add object id decoder awareness of string hex Mar 14, 2021
@glossd glossd force-pushed the bugfix/decoding-object-id-hex branch from cd791e6 to bddde89 Compare March 14, 2021 16:17
Copy link
Contributor

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your contribution to the driver @gl-ot ! I've authorized the CI patch build, and it looks like everything passes. We'll merge this and/or request changes once other team members have reviewed.

Copy link
Contributor

@divjotarora divjotarora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @gl-ot! Just one small comment from me, but otherwise the change looks good.

@glossd glossd requested a review from divjotarora March 17, 2021 18:01
Copy link
Contributor

@divjotarora divjotarora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I authorized a new CI patch, but this looks great. Thanks again!

@benjirewis benjirewis merged commit 4ccd545 into mongodb:master Mar 17, 2021
divjotarora pushed a commit to divjotarora/mongo-go-driver that referenced this pull request Mar 18, 2021
divjotarora pushed a commit to divjotarora/mongo-go-driver that referenced this pull request Mar 18, 2021
divjotarora pushed a commit to divjotarora/mongo-go-driver that referenced this pull request Mar 18, 2021
faem pushed a commit to kubedb/mongo-go-driver that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants