-
Notifications
You must be signed in to change notification settings - Fork 883
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-2706 Deprecate all code in the bsonoptions package. #1269
GODRIVER-2706 Deprecate all code in the bsonoptions package. #1269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you also update the examples here? https://github.com/mongodb/mongo-go-driver/blob/master/bson/mgocompat/registry.go |
the deprecation comment isn't helpful, as it suggest to register StructCodec, which is itself deprecated:
|
@quipo The deprecation note on I'm not sure what you mean about updating examples in |
Hi @matthewdale, thanks for your kind reply. Let me expand on what I was trying to say...
So to me the comment isn't useful in understanding what the suggested migration is.
Here's what I had:
Thanks! |
@quipo Thank you for the example, that clarifies the question a lot! Here's the new way to configure a import "go.mongodb.org/mongo-driver/mongo/options"
func NewMongoClientOptions(mongoDBURI string) (*options.ClientOptions, error) {
bsonOpts := &options.BSONOptions{
ZeroStructs: true,
OmitZeroStruct: true,
ErrorOnInlineDuplicates: true,
}
return options.Client().ApplyURI(mongoDBURI).SetBSONOptions(bsonOpts), nil
} Note that I agree the deprecation notice should more clearly identify the replacement functionality. I've created GODRIVER-2886 to track that improvement. |
thanks! |
GODRIVER-2706
Summary
bsonoptions
package with suggested alternatives.Decoder.UseLocalTimeZone
option and deprecateTimeCodec.UseLocalTimeZone
and the correspondingbsonoptions
options. Note this should have been done with #1229, but I missed it.StringCodec.DecodeObjectIDAsHex
. Note this should have been done with #1229, but I missed it.Background & Motivation
Currently the
bsonoptions
package is used exclusively to define configuration options for types and functions in thebsoncodec
package. Those options structs are almost exact duplicates of most of the*Codec
structs, which are all deprecated now as well.