Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions mongo/readpref/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ func WithTagSets(tagSets ...tag.Set) Option {
}
}

// WithHedgeEnabled specifies whether or not hedged reads should be enabled in the server. This feature requires MongoDB
// server version 4.4 or higher. For more information about hedged reads, see
// https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/#mongos-hedged-reads. If not specified, the default
// is to not send a value to the server, which will result in the server defaults being used.
// WithHedgeEnabled specifies whether or not hedged reads should be enabled in
// the server. This feature requires MongoDB server version 4.4 or higher. For
// more information about hedged reads, see
// https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/#mongos-hedged-reads.
// If not specified, the default is to not send a value to the server, which
// will result in the server defaults being used.
//
// Deprecated: Hedged reads are deprecated in MongoDB 8.0 and may be removed in
// a future MongoDB version.
func WithHedgeEnabled(hedgeEnabled bool) Option {
return func(rp *ReadPref) error {
rp.hedgeEnabled = &hedgeEnabled
Expand Down
8 changes: 6 additions & 2 deletions mongo/readpref/readpref.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ func (r *ReadPref) TagSets() []tag.Set {
return r.tagSets
}

// HedgeEnabled returns whether or not hedged reads are enabled for this read preference. If this option was not
// specified during read preference construction, nil is returned.
// HedgeEnabled returns whether or not hedged reads are enabled for this read
// preference. If this option was not specified during read preference
// construction, nil is returned.
//
// Deprecated: Hedged reads are deprecated in MongoDB 8.0 and may be removed in
// a future MongoDB version.
func (r *ReadPref) HedgeEnabled() *bool {
return r.hedgeEnabled
}
Expand Down
Loading