Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-1919 Add object id decoder awareness of string hex #610

Merged
merged 2 commits into from Mar 17, 2021

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 Mar 14, 2021
Copy link
Collaborator

@benjirewis benjirewis left a comment

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
Collaborator

@divjotarora divjotarora left a comment

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

bson/bsoncodec/default_value_decoders.go Show resolved Hide resolved
@glossd glossd requested a review from divjotarora Mar 17, 2021
Copy link
Collaborator

@divjotarora divjotarora left a comment

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

iwysiu
iwysiu approved these changes Mar 17, 2021
@benjirewis benjirewis merged commit 4ccd545 into mongodb:master Mar 17, 2021
15 checks passed
divjotarora added a commit to divjotarora/mongo-go-driver that referenced this issue Mar 18, 2021
divjotarora added a commit to divjotarora/mongo-go-driver that referenced this issue Mar 18, 2021
divjotarora added a commit to divjotarora/mongo-go-driver that referenced this issue Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants