Skip to content

Commit 9e9c6f1

Browse files
committedMar 22, 2025··
GODRIVER-3098 Drop support for MongoDB 3.6
1 parent ea8a75c commit 9e9c6f1

27 files changed

+176
-263
lines changed
 

‎.evergreen/config.yml

-17
Original file line numberDiff line numberDiff line change
@@ -1722,10 +1722,6 @@ axes:
17221722
display_name: "4.0"
17231723
variables:
17241724
VERSION: "4.0"
1725-
- id: "3.6"
1726-
display_name: "3.6"
1727-
variables:
1728-
VERSION: "3.6"
17291725
- id: "rapid"
17301726
display_name: "rapid"
17311727
variables:
@@ -2177,19 +2173,6 @@ buildvariants:
21772173
tasks:
21782174
- name: ".goleak"
21792175

2180-
- matrix_name: "tests-rhel-36-with-zlib-support"
2181-
tags: ["pullrequest"]
2182-
matrix_spec: { version: ["3.6"], os-ssl-32: ["rhel87-64"] }
2183-
display_name: "${version} ${os-ssl-32}"
2184-
tasks:
2185-
- name: ".test !.enterprise-auth !.snappy !.zstd"
2186-
2187-
- matrix_name: "tests-windows-36-with-zlib-support"
2188-
matrix_spec: { version: ["3.6"], os-ssl-32: ["windows-64"] }
2189-
display_name: "${version} ${os-ssl-32}"
2190-
tasks:
2191-
- name: ".test !.enterprise-auth !.snappy !.zstd"
2192-
21932176
- matrix_name: "tests-rhel-40-with-snappy-support"
21942177
tags: ["pullrequest"]
21952178
matrix_spec: { version: ["4.0"], os-ssl-40: ["rhel87-64"] }

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ See the following resources to learn more about upgrading from version 1.x to 2.
1919

2020
- Go 1.18 or higher. We aim to support the latest versions of Go.
2121
- Go 1.23 or higher is required to run the driver test suite.
22-
- MongoDB 3.6 and higher.
22+
- MongoDB 4.0 and higher.
2323

2424
## Installation
2525

‎internal/driverutil/description.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
)
2222

2323
const (
24-
MinWireVersion = 6
24+
MinWireVersion = 7
2525
MaxWireVersion = 25
2626
)
2727

‎internal/integration/causal_consistency_test.go

-34
Original file line numberDiff line numberDiff line change
@@ -201,40 +201,6 @@ func TestCausalConsistency_Supported(t *testing.T) {
201201
})
202202
}
203203

204-
func TestCausalConsistency_NotSupported(t *testing.T) {
205-
// use RunOnBlock instead of mtest.NewOptions().MaxServerVersion("3.4").Topologies(mtest.Single) because
206-
// these tests should be run on servers <= 3.4 OR standalones
207-
rob := []mtest.RunOnBlock{
208-
{MaxServerVersion: "3.4"},
209-
{Topology: []mtest.TopologyKind{mtest.Single}},
210-
}
211-
mt := mtest.New(t, mtest.NewOptions().RunOn(rob...).CreateClient(false))
212-
213-
mt.Run("afterClusterTime not included", func(mt *mtest.T) {
214-
// a read in a causally consistent session does not include afterClusterTime in a deployment that does not
215-
// support cluster times
216-
217-
sessOpts := options.Session().SetCausalConsistency(true)
218-
_ = mt.Client.UseSessionWithOptions(context.Background(), sessOpts, func(ctx context.Context) error {
219-
_, _ = mt.Coll.Find(ctx, bson.D{})
220-
return nil
221-
})
222-
223-
evt := mt.GetStartedEvent()
224-
assert.Equal(mt, "find", evt.CommandName, "expected command 'find', got '%v'", evt.CommandName)
225-
checkOperationTime(mt, evt.Command, false)
226-
})
227-
mt.Run("clusterTime not included", func(mt *mtest.T) {
228-
// $clusterTime should not be included in commands if the deployment does not support cluster times
229-
230-
_ = mt.Coll.FindOne(context.Background(), bson.D{})
231-
evt := mt.GetStartedEvent()
232-
assert.Equal(mt, "find", evt.CommandName, "expected command 'find', got '%v'", evt.CommandName)
233-
_, err := evt.Command.LookupErr("$clusterTime")
234-
assert.NotNil(mt, err, "expected $clusterTime to not be sent, but was")
235-
})
236-
}
237-
238204
func checkOperationTime(mt *mtest.T, cmd bson.Raw, shouldInclude bool) {
239205
mt.Helper()
240206

‎internal/integration/index_view_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,6 @@ func TestIndexView(t *testing.T) {
528528
Unique: nil,
529529
},
530530
}
531-
if mtest.CompareServerVersions(mtest.ServerVersion(), "3.4") < 0 {
532-
for _, expectedSpec := range expectedSpecs {
533-
expectedSpec.Version = 1
534-
}
535-
}
536531

537532
specs, err := mt.Coll.Indexes().ListSpecifications(context.Background())
538533
assert.Nil(mt, err, "ListSpecifications error: %v", err)

‎mongo/bulk_write_models.go

+35-30
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ func (dom *DeleteOneModel) SetCollation(collation *options.Collation) *DeleteOne
7070
return dom
7171
}
7272

73-
// SetHint specifies the index to use for the operation. This should either be the index name as a string or the index
74-
// specification as a document. This option is only valid for MongoDB versions >= 4.4. Server versions >= 3.4 will
75-
// return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if
76-
// this option is specified. The driver will return an error if this option is specified during an unacknowledged write
77-
// operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which
78-
// means that no hint will be sent.
73+
// SetHint specifies the index to use for the operation. This should either be
74+
// the index name as a string or the index specification as a document. This
75+
// option is only valid for MongoDB versions >= 4.4. Server versions < 4.4 will
76+
// return an error if this option is specified. The driver will return an error
77+
// if this option is specified during an unacknowledged write operation. The
78+
// driver will return an error if the hint parameter is a multi-key map. The
79+
// default value is nil, which means that no hint will be sent.
7980
func (dom *DeleteOneModel) SetHint(hint interface{}) *DeleteOneModel {
8081
dom.Hint = hint
8182
return dom
@@ -111,12 +112,13 @@ func (dmm *DeleteManyModel) SetCollation(collation *options.Collation) *DeleteMa
111112
return dmm
112113
}
113114

114-
// SetHint specifies the index to use for the operation. This should either be the index name as a string or the index
115-
// specification as a document. This option is only valid for MongoDB versions >= 4.4. Server versions >= 3.4 will
116-
// return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if
117-
// this option is specified. The driver will return an error if this option is specified during an unacknowledged write
118-
// operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which
119-
// means that no hint will be sent.
115+
// SetHint specifies the index to use for the operation. This should either be
116+
// the index name as a string or the index specification as a document. This
117+
// option is only valid for MongoDB versions >= 4.4. Server versions < 4.4 will
118+
// return an error if this option is specified. The driver will return an error
119+
// if this option is specified during an unacknowledged write operation. The
120+
// driver will return an error if the hint parameter is a multi-key map. The
121+
// default value is nil, which means that no hint will be sent.
120122
func (dmm *DeleteManyModel) SetHint(hint interface{}) *DeleteManyModel {
121123
dmm.Hint = hint
122124
return dmm
@@ -141,12 +143,13 @@ func NewReplaceOneModel() *ReplaceOneModel {
141143
return &ReplaceOneModel{}
142144
}
143145

144-
// SetHint specifies the index to use for the operation. This should either be the index name as a string or the index
145-
// specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will
146-
// return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if
147-
// this option is specified. The driver will return an error if this option is specified during an unacknowledged write
148-
// operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which
149-
// means that no hint will be sent.
146+
// SetHint specifies the index to use for the operation. This should either be
147+
// the index name as a string or the index specification as a document. This
148+
// option is only valid for MongoDB versions >= 4.2. Server versions < 4.2 will
149+
// return an error if this option is specified. The driver will return an error
150+
// if this option is specified during an unacknowledged write operation. The
151+
// driver will return an error if the hint parameter is a multi-key map. The
152+
// default value is nil, which means that no hint will be sent.
150153
func (rom *ReplaceOneModel) SetHint(hint interface{}) *ReplaceOneModel {
151154
rom.Hint = hint
152155
return rom
@@ -211,12 +214,13 @@ func NewUpdateOneModel() *UpdateOneModel {
211214
return &UpdateOneModel{}
212215
}
213216

214-
// SetHint specifies the index to use for the operation. This should either be the index name as a string or the index
215-
// specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will
216-
// return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if
217-
// this option is specified. The driver will return an error if this option is specified during an unacknowledged write
218-
// operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which
219-
// means that no hint will be sent.
217+
// SetHint specifies the index to use for the operation. This should either be
218+
// the index name as a string or the index specification as a document. This
219+
// option is only valid for MongoDB versions >= 4.2. Server versions < 4.2 will
220+
// return an error if this option is specified. The driver will return an error
221+
// if this option is specified during an unacknowledged write operation. The
222+
// driver will return an error if the hint parameter is a multi-key map. The
223+
// default value is nil, which means that no hint will be sent.
220224
func (uom *UpdateOneModel) SetHint(hint interface{}) *UpdateOneModel {
221225
uom.Hint = hint
222226
return uom
@@ -287,12 +291,13 @@ func NewUpdateManyModel() *UpdateManyModel {
287291
return &UpdateManyModel{}
288292
}
289293

290-
// SetHint specifies the index to use for the operation. This should either be the index name as a string or the index
291-
// specification as a document. This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will
292-
// return an error if this option is specified. For server versions < 3.4, the driver will return a client-side error if
293-
// this option is specified. The driver will return an error if this option is specified during an unacknowledged write
294-
// operation. The driver will return an error if the hint parameter is a multi-key map. The default value is nil, which
295-
// means that no hint will be sent.
294+
// SetHint specifies the index to use for the operation. This should either be
295+
// the index name as a string or the index specification as a document. This
296+
// option is only valid for MongoDB versions >= 4.2. Server versions < 4.2 will
297+
// return an error if this option is specified. The driver will return an error
298+
// if this option is specified during an unacknowledged write operation. The
299+
// driver will return an error if the hint parameter is a multi-key map. The
300+
// default value is nil, which means that no hint will be sent.
296301
func (umm *UpdateManyModel) SetHint(hint interface{}) *UpdateManyModel {
297302
umm.Hint = hint
298303
return umm

‎mongo/database.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ func (db *Database) Collection(name string, opts ...options.Lister[options.Colle
118118
return newCollection(db, name, opts...)
119119
}
120120

121-
// Aggregate executes an aggregate command the database. This requires MongoDB version >= 3.6 and driver version >=
122-
// 1.1.0.
121+
// Aggregate executes an aggregate command the database.
123122
//
124123
// The pipeline parameter must be a slice of documents, each representing an aggregation stage. The pipeline
125124
// cannot be nil but can be empty. The stage documents must all be non-nil. For a pipeline of bson.D documents, the

‎mongo/options/aggregateoptions.go

+4-7
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ func (ao *AggregateOptionsBuilder) SetBatchSize(i int32) *AggregateOptionsBuilde
7070
}
7171

7272
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true, writes
73-
// executed as part of the operation will opt out of document-level validation on the server. This
74-
// option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The default value
73+
// executed as part of the operation will opt out of document-level validation on the server. The default value
7574
// is false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about
7675
// document validation.
7776
func (ao *AggregateOptionsBuilder) SetBypassDocumentValidation(b bool) *AggregateOptionsBuilder {
@@ -84,9 +83,8 @@ func (ao *AggregateOptionsBuilder) SetBypassDocumentValidation(b bool) *Aggregat
8483
return ao
8584
}
8685

87-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
88-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For previous
89-
// server versions, the driver will return an error if this option is used. The default value is nil,
86+
// SetCollation sets the value for the Collation field. Specifies a collation to
87+
// use for string comparisons during the operation. The default value is nil,
9088
// which means the default collation of the collection will be used.
9189
func (ao *AggregateOptionsBuilder) SetCollation(c *Collation) *AggregateOptionsBuilder {
9290
ao.Opts = append(ao.Opts, func(opts *AggregateOptions) error {
@@ -99,8 +97,7 @@ func (ao *AggregateOptionsBuilder) SetCollation(c *Collation) *AggregateOptionsB
9997
}
10098

10199
// SetMaxAwaitTime sets the value for the MaxAwaitTime field. Specifies maximum amount of time
102-
// that the server should wait for new documents to satisfy a tailable cursor query. This option is
103-
// only valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
100+
// that the server should wait for new documents to satisfy a tailable cursor query.
104101
func (ao *AggregateOptionsBuilder) SetMaxAwaitTime(d time.Duration) *AggregateOptionsBuilder {
105102
ao.Opts = append(ao.Opts, func(opts *AggregateOptions) error {
106103
opts.MaxAwaitTime = &d

‎mongo/options/bulkwriteoptions.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ func (b *BulkWriteOptionsBuilder) SetOrdered(ordered bool) *BulkWriteOptionsBuil
6666
}
6767

6868
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true, writes
69-
// executed as part of the operation will opt out of document-level validation on the server. This option
70-
// is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The default value is
69+
// executed as part of the operation will opt out of document-level validation on the server. The default value is
7170
// false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about document
7271
// validation.
7372
func (b *BulkWriteOptionsBuilder) SetBypassDocumentValidation(bypass bool) *BulkWriteOptionsBuilder {

‎mongo/options/changestreamoptions.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ func (cso *ChangeStreamOptionsBuilder) SetBatchSize(i int32) *ChangeStreamOption
5757
return cso
5858
}
5959

60-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string comparisons
61-
// during the operation. This option is only valid for MongoDB versions >= 3.4. For previous server versions,
62-
// the driver will return an error if this option is used. The default value is nil, which means the default
63-
// collation of the collection will be used.
60+
// SetCollation sets the value for the Collation field. Specifies a collation to
61+
// use for string comparisons during the operation. The default value is nil,
62+
// which means the default collation of the collection will be used.
6463
func (cso *ChangeStreamOptionsBuilder) SetCollation(c Collation) *ChangeStreamOptionsBuilder {
6564
cso.Opts = append(cso.Opts, func(opts *ChangeStreamOptions) error {
6665
opts.Collation = &c

‎mongo/options/clientoptions.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,9 @@ func (c *ClientOptions) SetAuth(auth Credential) *ClientOptions {
686686

687687
// SetCompressors sets the compressors that can be used when communicating with a server. Valid values are:
688688
//
689-
// 1. "snappy" - requires server version >= 3.4
689+
// 1. "snappy"
690690
//
691-
// 2. "zlib" - requires server version >= 3.6
691+
// 2. "zlib"
692692
//
693693
// 3. "zstd" - requires server version >= 4.2, and driver version >= 1.2.0 with cgo support enabled or driver
694694
// version >= 1.3.0 without cgo.
@@ -920,9 +920,8 @@ func (c *ClientOptions) SetReplicaSet(s string) *ClientOptions {
920920
// DeleteManyModel instances to be considered retryable. Unacknowledged writes will not be retried, even if this option
921921
// is set to true.
922922
//
923-
// This option requires server version >= 3.6 and a replica set or sharded cluster and will be ignored for any other
924-
// cluster type. This can also be set through the "retryWrites" URI option (e.g. "retryWrites=true"). The default is
925-
// true.
923+
// This option only works on a replica set or sharded cluster and will be ignored for any other cluster type.
924+
// This can also be set through the "retryWrites" URI option (e.g. "retryWrites=true"). The default is true.
926925
func (c *ClientOptions) SetRetryWrites(b bool) *ClientOptions {
927926
c.RetryWrites = &b
928927

@@ -936,7 +935,7 @@ func (c *ClientOptions) SetRetryWrites(b bool) *ClientOptions {
936935
// EstimatedDocumentCount, Watch (for Client, Database, and Collection), ListCollections, and ListDatabases. Note that
937936
// operations run through RunCommand are not retried.
938937
//
939-
// This option requires server version >= 3.6 and driver version >= 1.1.0. The default is true.
938+
// The default is true.
940939
func (c *ClientOptions) SetRetryReads(b bool) *ClientOptions {
941940
c.RetryReads = &b
942941

‎mongo/options/countoptions.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ func (co *CountOptionsBuilder) List() []func(*CountOptions) error {
3535
return co.Opts
3636
}
3737

38-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string comparisons
39-
// during the operation. This option is only valid for MongoDB versions >= 3.4. For previous server versions,
40-
// the driver will return an error if this option is used. The default value is nil, which means the default
41-
// collation of the collection will be used.
38+
// SetCollation sets the value for the Collation field. Specifies a collation to
39+
// use for string comparisons during the operation. The default value is nil,
40+
// which means the default collation of the collection will be used.
4241
func (co *CountOptionsBuilder) SetCollation(c *Collation) *CountOptionsBuilder {
4342
co.Opts = append(co.Opts, func(opts *CountOptions) error {
4443
opts.Collation = c

‎mongo/options/createcollectionoptions.go

+10-13
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,8 @@ func (c *CreateCollectionOptionsBuilder) SetCapped(capped bool) *CreateCollectio
193193
return c
194194
}
195195

196-
// SetCollation sets the value for the Collation field. Specifies the default collation for the new
197-
// collection. This option is only valid for MongoDB versions >= 3.4. For previous server versions,
198-
// the driver will return an error if this option is used. The default value is nil.
196+
// SetCollation sets the value for the Collation field. Specifies the default
197+
// collation for the new collection. The default value is nil.
199198
func (c *CreateCollectionOptionsBuilder) SetCollation(collation *Collation) *CreateCollectionOptionsBuilder {
200199
c.Opts = append(c.Opts, func(opts *CreateCollectionOptions) error {
201200
opts.Collation = collation
@@ -222,9 +221,9 @@ func (c *CreateCollectionOptionsBuilder) SetChangeStreamPreAndPostImages(csppi i
222221
return c
223222
}
224223

225-
// SetDefaultIndexOptions sets the value for the DefaultIndexOptions field. Specifies a default
226-
// configuration for indexes on the collection. This option is only valid for MongoDB versions
227-
// >= 3.4. The default value is nil, meaning indexes will be configured using server defaults.
224+
// SetDefaultIndexOptions sets the value for the DefaultIndexOptions field.
225+
// Specifies a default configuration for indexes on the collection. The default
226+
// value is nil, meaning indexes will be configured using server defaults.
228227
func (c *CreateCollectionOptionsBuilder) SetDefaultIndexOptions(iopts *DefaultIndexOptionsBuilder) *CreateCollectionOptionsBuilder {
229228
c.Opts = append(c.Opts, func(opts *CreateCollectionOptions) error {
230229
opts.DefaultIndexOptions = iopts
@@ -278,7 +277,7 @@ func (c *CreateCollectionOptionsBuilder) SetStorageEngine(storageEngine interfac
278277
// SetValidationAction sets the value for the ValidationAction field. Specifies what should happen if a
279278
// document being inserted does not pass validation. Valid values are "error" and "warn". See
280279
// https://www.mongodb.com/docs/manual/core/schema-validation/#accept-or-reject-invalid-documents for more
281-
// information. This option is only valid for MongoDB versions >= 3.2. The default value is "error".
280+
// information. The default value is "error".
282281
func (c *CreateCollectionOptionsBuilder) SetValidationAction(action string) *CreateCollectionOptionsBuilder {
283282
c.Opts = append(c.Opts, func(opts *CreateCollectionOptions) error {
284283
opts.ValidationAction = &action
@@ -292,7 +291,7 @@ func (c *CreateCollectionOptionsBuilder) SetValidationAction(action string) *Cre
292291
// SetValidationLevel sets the value for the ValidationLevel field. Specifies how strictly the server applies
293292
// validation rules to existing documents in the collection during update operations. Valid values are "off",
294293
// "strict", and "moderate". See https://www.mongodb.com/docs/manual/core/schema-validation/#existing-documents
295-
// for more information. This option is only valid for MongoDB versions >= 3.2. The default value is "strict".
294+
// for more information. The default value is "strict".
296295
func (c *CreateCollectionOptionsBuilder) SetValidationLevel(level string) *CreateCollectionOptionsBuilder {
297296
c.Opts = append(c.Opts, func(opts *CreateCollectionOptions) error {
298297
opts.ValidationLevel = &level
@@ -305,8 +304,7 @@ func (c *CreateCollectionOptionsBuilder) SetValidationLevel(level string) *Creat
305304

306305
// SetValidator sets the value for the Validator field. Sets a document specifying validation rules for the
307306
// collection. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about
308-
// schema validation. This option is only valid for MongoDB versions >= 3.2. The default value is nil,
309-
// meaning no validator will be used for the collection.
307+
// schema validation. The default value is nil, meaning no validator will be used for the collection.
310308
func (c *CreateCollectionOptionsBuilder) SetValidator(validator interface{}) *CreateCollectionOptionsBuilder {
311309
c.Opts = append(c.Opts, func(opts *CreateCollectionOptions) error {
312310
opts.Validator = validator
@@ -402,9 +400,8 @@ func (c *CreateViewOptionsBuilder) List() []func(*CreateViewOptions) error {
402400
return c.Opts
403401
}
404402

405-
// SetCollation sets the value for the Collation field. Specifies the default collation for the new
406-
// collection. This option is only valid for MongoDB versions >= 3.4. For previous server versions,
407-
// the driver will return an error if this option is used. The default value is nil.
403+
// SetCollation sets the value for the Collation field. Specifies the default
404+
// collation for the new collection. The default value is nil.
408405
func (c *CreateViewOptionsBuilder) SetCollation(collation *Collation) *CreateViewOptionsBuilder {
409406
c.Opts = append(c.Opts, func(opts *CreateViewOptions) error {
410407
opts.Collation = collation

‎mongo/options/deleteoptions.go

+22-24
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ func (do *DeleteOneOptionsBuilder) List() []func(*DeleteOneOptions) error {
3434
return do.Opts
3535
}
3636

37-
// SetCollation sets the value for the Collation field. Specifies a collation to use for
38-
// string comparisons during the operation. This option is only valid for MongoDB
39-
// versions >= 3.4. For previous server versions, the driver will return an error if this
40-
// option is used. The default value is nil, which means the default collation of the
41-
// collection will be used.
37+
// SetCollation sets the value for the Collation field. Specifies a collation to
38+
// use for string comparisons during the operation. The default value is nil,
39+
// which means the default collation of the collection will be used.
4240
func (do *DeleteOneOptionsBuilder) SetCollation(c *Collation) *DeleteOneOptionsBuilder {
4341
do.Opts = append(do.Opts, func(opts *DeleteOneOptions) error {
4442
opts.Collation = c
@@ -62,13 +60,14 @@ func (do *DeleteOneOptionsBuilder) SetComment(comment interface{}) *DeleteOneOpt
6260
return do
6361
}
6462

65-
// SetHint sets the value for the Hint field. Specifies the index to use for the operation. This
66-
// should either be the index name as a string or the index specification as a document. This option
67-
// is only valid for MongoDB versions >= 4.4. Server versions >= 3.4 will return an error if this
68-
// option is specified. For server versions < 3.4, the driver will return a client-side error if this
69-
// option is specified. The driver will return an error if this option is specified during an
70-
// unacknowledged write operation. The driver will return an error if the hint parameter is a
71-
// multi-key map. The default value is nil, which means that no hint will be sent.
63+
// SetHint sets the value for the Hint field. Specifies the index to use for the
64+
// operation. This should either be the index name as a string or the index
65+
// specification as a document. This option is only valid for MongoDB versions
66+
// >= 4.4. Server versions < 4.4 will return an error if this option is
67+
// specified. The driver will return an error if this option is specified during
68+
// an unacknowledged write operation. The driver will return an error if the
69+
// hint parameter is a multi-key map. The default value is nil, which means that
70+
// no hint will be sent.
7271
func (do *DeleteOneOptionsBuilder) SetHint(hint interface{}) *DeleteOneOptionsBuilder {
7372
do.Opts = append(do.Opts, func(opts *DeleteOneOptions) error {
7473
opts.Hint = hint
@@ -122,10 +121,9 @@ func (do *DeleteManyOptionsBuilder) List() []func(*DeleteManyOptions) error {
122121
return do.Opts
123122
}
124123

125-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
126-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4.
127-
// For previous server versions, the driver will return an error if this option is used. The
128-
// default value is nil, which means the default collation of the collection will be used.
124+
// SetCollation sets the value for the Collation field. Specifies a collation to
125+
// use for string comparisons during the operation. The default value is nil,
126+
// which means the default collation of the collection will be used.
129127
func (do *DeleteManyOptionsBuilder) SetCollation(c *Collation) *DeleteManyOptionsBuilder {
130128
do.Opts = append(do.Opts, func(opts *DeleteManyOptions) error {
131129
opts.Collation = c
@@ -149,14 +147,14 @@ func (do *DeleteManyOptionsBuilder) SetComment(comment interface{}) *DeleteManyO
149147
return do
150148
}
151149

152-
// SetHint sets the value for the Hint field. Specifies the index to use for the operation.
153-
// This should either be the index name as a string or the index specification as a document.
154-
// This option is only valid for MongoDB versions >= 4.4. Server versions >= 3.4 will return an
155-
// error if this option is specified. For server versions < 3.4, the driver will return a
156-
// client-side error if this option is specified. The driver will return an error if this option
157-
// is specified during an unacknowledged write operation. The driver will return an error if the
158-
// hint parameter is a multi-key map. The default value is nil, which means that no hint will
159-
// be sent.
150+
// SetHint sets the value for the Hint field. Specifies the index to use for the
151+
// operation. This should either be the index name as a string or the index
152+
// specification as a document. This option is only valid for MongoDB versions
153+
// >= 4.4. Server versions < 4.4 will return an error if this option is
154+
// specified. The driver will return an error if this option is specified during
155+
// an unacknowledged write operation. The driver will return an error if the
156+
// hint parameter is a multi-key map. The default value is nil, which means that
157+
// no hint will be sent.
160158
func (do *DeleteManyOptionsBuilder) SetHint(hint interface{}) *DeleteManyOptionsBuilder {
161159
do.Opts = append(do.Opts, func(opts *DeleteManyOptions) error {
162160
opts.Hint = hint

‎mongo/options/distinctoptions.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ func (do *DistinctOptionsBuilder) List() []func(*DistinctOptions) error {
3333
return do.Opts
3434
}
3535

36-
// SetCollation sets the value for the Collation field. Specifies a collation to use
37-
// for string comparisons during the operation. This option is only valid for MongoDB
38-
// versions >= 3.4. For previous server versions, the driver will return an error if
39-
// this option is used. The default value is nil, which means the default collation
40-
// of the collection will be used.
36+
// SetCollation sets the value for the Collation field. Specifies a collation to
37+
// use for string comparisons during the operation. The default value is nil,
38+
// which means the default collation of the collection will be used.
4139
func (do *DistinctOptionsBuilder) SetCollation(c *Collation) *DistinctOptionsBuilder {
4240
do.Opts = append(do.Opts, func(opts *DistinctOptions) error {
4341
opts.Collation = c

‎mongo/options/findoptions.go

+31-38
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ func (f *FindOptionsBuilder) List() []func(*FindOptions) error {
5252
return f.Opts
5353
}
5454

55-
// SetAllowDiskUse sets the value for the AllowDiskUse field. AllowDiskUse specifies whether the
56-
// server can write temporary data to disk while executing the Find operation. This option is only
57-
// valid for MongoDB versions >= 4.4. Server versions >= 3.2 will report an error if this option
58-
// is specified. For server versions < 3.2, the driver will return a client-side error if this
59-
// option is specified. The default value is false.
55+
// SetAllowDiskUse sets the value for the AllowDiskUse field. AllowDiskUse
56+
// specifies whether the server can write temporary data to disk while executing
57+
// the Find operation. This option is only valid for MongoDB versions >= 4.4.
58+
// Server versions < 4.4 will return an error if this option is specified. The
59+
// default value is false.
6060
func (f *FindOptionsBuilder) SetAllowDiskUse(b bool) *FindOptionsBuilder {
6161
f.Opts = append(f.Opts, func(opts *FindOptions) error {
6262
opts.AllowDiskUse = &b
@@ -86,10 +86,10 @@ func (f *FindOptionsBuilder) SetBatchSize(i int32) *FindOptionsBuilder {
8686
return f
8787
}
8888

89-
// SetCollation sets the value for the Collation field. Collation specifies a collation to use for
90-
// string comparisons during the operation. This option is only valid for MongoDB versions >= 3.4.
91-
// For previous server versions, the driver will return an error if this option is used. The
92-
// default value is nil, which means the default collation of the collection will be used.
89+
// SetCollation sets the value for the Collation field. Collation specifies a
90+
// collation to use for string comparisons during the operation. The default
91+
// value is nil, which means the default collation of the collection will be
92+
// used.
9393
func (f *FindOptionsBuilder) SetCollation(collation *Collation) *FindOptionsBuilder {
9494
f.Opts = append(f.Opts, func(opts *FindOptions) error {
9595
opts.Collation = collation
@@ -167,11 +167,11 @@ func (f *FindOptionsBuilder) SetMax(max interface{}) *FindOptionsBuilder {
167167
return f
168168
}
169169

170-
// SetMaxAwaitTime sets the value for the MaxAwaitTime field. MaxAwaitTime is the maximum amount of
171-
// time that the server should wait for new documents to satisfy a tailable cursor query. This
172-
// option is only valid for tailable await cursors (see the CursorType option for more information)
173-
// and MongoDB versions >= 3.2. For other cursor types or previous server versions, this option
174-
// is ignored.
170+
// SetMaxAwaitTime sets the value for the MaxAwaitTime field. MaxAwaitTime is
171+
// the maximum amount of time that the server should wait for new documents to
172+
// satisfy a tailable cursor query. This option is only valid for tailable await
173+
// cursors (see the CursorType option for more information). For other cursor
174+
// types, this option is ignored.
175175
func (f *FindOptionsBuilder) SetMaxAwaitTime(d time.Duration) *FindOptionsBuilder {
176176
f.Opts = append(f.Opts, func(opts *FindOptions) error {
177177
opts.MaxAwaitTime = &d
@@ -314,10 +314,9 @@ func (f *FindOneOptionsBuilder) SetAllowPartialResults(b bool) *FindOneOptionsBu
314314
return f
315315
}
316316

317-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
318-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For
319-
// previous server versions, the driver will return an error if this option is used. The
320-
// default value is nil, which means the default collation of the collection will be used.
317+
// SetCollation sets the value for the Collation field. Specifies a collation to
318+
// use for string comparisons during the operation. The default value is nil,
319+
// which means the default collation of the collection will be used.
321320
func (f *FindOneOptionsBuilder) SetCollation(collation *Collation) *FindOneOptionsBuilder {
322321
f.Opts = append(f.Opts, func(opts *FindOneOptions) error {
323322
opts.Collation = collation
@@ -471,8 +470,7 @@ func (f *FindOneAndReplaceOptionsBuilder) List() []func(*FindOneAndReplaceOption
471470
}
472471

473472
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true, writes
474-
// executed as part of the operation will opt out of document-level validation on the server. This
475-
// option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The
473+
// executed as part of the operation will opt out of document-level validation on the server. The
476474
// default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more
477475
// information about document validation.
478476
func (f *FindOneAndReplaceOptionsBuilder) SetBypassDocumentValidation(b bool) *FindOneAndReplaceOptionsBuilder {
@@ -485,10 +483,9 @@ func (f *FindOneAndReplaceOptionsBuilder) SetBypassDocumentValidation(b bool) *F
485483
return f
486484
}
487485

488-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
489-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4.
490-
// For previous server versions, the driver will return an error if this option is used. The
491-
// default value is nil, which means the default collation of the collection will be used.
486+
// SetCollation sets the value for the Collation field. Specifies a collation to
487+
// use for string comparisons during the operation. The default value is nil,
488+
// which means the default collation of the collection will be used.
492489
func (f *FindOneAndReplaceOptionsBuilder) SetCollation(collation *Collation) *FindOneAndReplaceOptionsBuilder {
493490
f.Opts = append(f.Opts, func(opts *FindOneAndReplaceOptions) error {
494491
opts.Collation = collation
@@ -633,11 +630,10 @@ func (f *FindOneAndUpdateOptionsBuilder) List() []func(*FindOneAndUpdateOptions)
633630
return f.Opts
634631
}
635632

636-
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a set of filters
637-
// specifying to which array elements an update should apply. This option is only valid for
638-
// MongoDB versions >= 3.6. For previous server versions, the driver will return an error if
639-
// this option is used. The default value is nil, which means the update will apply to all
640-
// array elements.
633+
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a
634+
// set of filters specifying to which array elements an update should apply. The
635+
// default value is nil, which means the update will apply to all array
636+
// elements.
641637
func (f *FindOneAndUpdateOptionsBuilder) SetArrayFilters(filters []interface{}) *FindOneAndUpdateOptionsBuilder {
642638
f.Opts = append(f.Opts, func(opts *FindOneAndUpdateOptions) error {
643639
opts.ArrayFilters = filters
@@ -650,7 +646,6 @@ func (f *FindOneAndUpdateOptionsBuilder) SetArrayFilters(filters []interface{})
650646

651647
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
652648
// writes executed as part of the operation will opt out of document-level validation on the server.
653-
// This option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
654649
// The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/
655650
// for more information about document validation.
656651
func (f *FindOneAndUpdateOptionsBuilder) SetBypassDocumentValidation(b bool) *FindOneAndUpdateOptionsBuilder {
@@ -663,10 +658,9 @@ func (f *FindOneAndUpdateOptionsBuilder) SetBypassDocumentValidation(b bool) *Fi
663658
return f
664659
}
665660

666-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
667-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For
668-
// previous server versions, the driver will return an error if this option is used. The default
669-
// value is nil, which means the default collation of the collection will be used.
661+
// SetCollation sets the value for the Collation field. Specifies a collation to
662+
// use for string comparisons during the operation. The default value is nil,
663+
// which means the default collation of the collection will be used.
670664
func (f *FindOneAndUpdateOptionsBuilder) SetCollation(collation *Collation) *FindOneAndUpdateOptionsBuilder {
671665
f.Opts = append(f.Opts, func(opts *FindOneAndUpdateOptions) error {
672666
opts.Collation = collation
@@ -807,10 +801,9 @@ func (f *FindOneAndDeleteOptionsBuilder) List() []func(*FindOneAndDeleteOptions)
807801
return f.Opts
808802
}
809803

810-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
811-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4.
812-
// For previous server versions, the driver will return an error if this option is used. The
813-
// default value is nil, which means the default collation of the collection will be used.
804+
// SetCollation sets the value for the Collation field. Specifies a collation to
805+
// use for string comparisons during the operation. The default value is nil,
806+
// which means the default collation of the collection will be used.
814807
func (f *FindOneAndDeleteOptionsBuilder) SetCollation(collation *Collation) *FindOneAndDeleteOptionsBuilder {
815808
f.Opts = append(f.Opts, func(opts *FindOneAndDeleteOptions) error {
816809
opts.Collation = collation

‎mongo/options/indexoptions.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ func (i *IndexOptionsBuilder) SetSparse(sparse bool) *IndexOptionsBuilder {
262262
// SetStorageEngine sets the value for the StorageEngine field. Specifies the
263263
// storage engine to use for the index. The value must be a document in the form
264264
// {<storage engine name>: <options>}. The default value is nil, which means that
265-
// the default storage engine will be used. This option is only applicable for
266-
// MongoDB versions >= 3.0 and is ignored for previous server versions.
265+
// the default storage engine will be used.
267266
func (i *IndexOptionsBuilder) SetStorageEngine(engine interface{}) *IndexOptionsBuilder {
268267
i.Opts = append(i.Opts, func(opts *IndexOptions) error {
269268
opts.StorageEngine = engine
@@ -424,8 +423,7 @@ func (i *IndexOptionsBuilder) SetBucketSize(bucketSize int32) *IndexOptionsBuild
424423
}
425424

426425
// SetPartialFilterExpression sets the value for the PartialFilterExpression field. Sets
427-
// a document that defines which collection documents the index should reference. This
428-
// option is only valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
426+
// a document that defines which collection documents the index should reference.
429427
func (i *IndexOptionsBuilder) SetPartialFilterExpression(expression interface{}) *IndexOptionsBuilder {
430428
i.Opts = append(i.Opts, func(opts *IndexOptions) error {
431429
opts.PartialFilterExpression = expression
@@ -437,8 +435,7 @@ func (i *IndexOptionsBuilder) SetPartialFilterExpression(expression interface{})
437435
}
438436

439437
// SetCollation sets the value for the Collation field. Specifies the collation to use for
440-
// string comparisons for the index. This option is only valid for MongoDB versions >= 3.4.
441-
// For previous server versions, the driver will return an error if this option is used.
438+
// string comparisons for the index.
442439
func (i *IndexOptionsBuilder) SetCollation(collation *Collation) *IndexOptionsBuilder {
443440
i.Opts = append(i.Opts, func(opts *IndexOptions) error {
444441
opts.Collation = collation

‎mongo/options/insertoptions.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func (ioo *InsertOneOptionsBuilder) List() []func(*InsertOneOptions) error {
3333

3434
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
3535
// writes executed as part of the operation will opt out of document-level validation on the
36-
// server. This option is valid for MongoDB versions >= 3.2 and is ignored for previous server
37-
// versions. The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/
36+
// server. The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/
3837
// for more information about document validation.
3938
func (ioo *InsertOneOptionsBuilder) SetBypassDocumentValidation(b bool) *InsertOneOptionsBuilder {
4039
ioo.Opts = append(ioo.Opts, func(opts *InsertOneOptions) error {
@@ -86,8 +85,7 @@ func (imo *InsertManyOptionsBuilder) List() []func(*InsertManyOptions) error {
8685

8786
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
8887
// writes executed as part of the operation will opt out of document-level validation on the
89-
// server. This option is valid for MongoDB versions >= 3.2 and is ignored for previous server
90-
// versions. The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/
88+
// server. The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/
9189
// for more information about document validation.
9290
func (imo *InsertManyOptionsBuilder) SetBypassDocumentValidation(b bool) *InsertManyOptionsBuilder {
9391
imo.Opts = append(imo.Opts, func(opts *InsertManyOptions) error {

‎mongo/options/replaceoptions.go

+11-13
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func (ro *ReplaceOptionsBuilder) List() []func(*ReplaceOptions) error {
3939

4040
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
4141
// writes executed as part of the operation will opt out of document-level validation on the server.
42-
// This option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
4342
// The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for
4443
// more information about document validation.
4544
func (ro *ReplaceOptionsBuilder) SetBypassDocumentValidation(b bool) *ReplaceOptionsBuilder {
@@ -52,10 +51,9 @@ func (ro *ReplaceOptionsBuilder) SetBypassDocumentValidation(b bool) *ReplaceOpt
5251
return ro
5352
}
5453

55-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
56-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For
57-
// previous server versions, the driver will return an error if this option is used. The
58-
// default value is nil, which means the default collation of the collection will be used.
54+
// SetCollation sets the value for the Collation field. Specifies a collation to
55+
// use for string comparisons during the operation. The default value is nil,
56+
// which means the default collation of the collection will be used.
5957
func (ro *ReplaceOptionsBuilder) SetCollation(c *Collation) *ReplaceOptionsBuilder {
6058
ro.Opts = append(ro.Opts, func(opts *ReplaceOptions) error {
6159
opts.Collation = c
@@ -79,14 +77,14 @@ func (ro *ReplaceOptionsBuilder) SetComment(comment interface{}) *ReplaceOptions
7977
return ro
8078
}
8179

82-
// SetHint sets the value for the Hint field. Specifies the index to use for the operation.
83-
// This should either be the index name as a string or the index specification as a document.
84-
// This option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return
85-
// an error if this option is specified. For server versions < 3.4, the driver will return a
86-
// client-side error if this option is specified. The driver will return an error if this option
87-
// is specified during an unacknowledged write operation. The driver will return an error if
88-
// the hint parameter is a multi-key map. The default value is nil, which means that no hint
89-
// will be sent.
80+
// SetHint sets the value for the Hint field. Specifies the index to use for the
81+
// operation. This should either be the index name as a string or the index
82+
// specification as a document. This option is only valid for MongoDB versions
83+
// >= 4.2. Server versions < 4.2 will return an error if this option is
84+
// specified. The driver will return an error if this option is specified during
85+
// an unacknowledged write operation. The driver will return an error if the
86+
// hint parameter is a multi-key map. The default value is nil, which means that
87+
// no hint will be sent.
9088
func (ro *ReplaceOptionsBuilder) SetHint(h interface{}) *ReplaceOptionsBuilder {
9189
ro.Opts = append(ro.Opts, func(opts *ReplaceOptions) error {
9290
opts.Hint = h

‎mongo/options/updateoptions.go

+30-32
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func (uo *UpdateOneOptionsBuilder) List() []func(*UpdateOneOptions) error {
3838
return uo.Opts
3939
}
4040

41-
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a set of filters
42-
// specifying to which array elements an update should apply. This option is only valid for MongoDB
43-
// versions >= 3.6. For previous server versions, the driver will return an error if this option is
44-
// used. The default value is nil, which means the update will apply to all array elements.
41+
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a
42+
// set of filters specifying to which array elements an update should apply. The
43+
// default value is nil, which means the update will apply to all array
44+
// elements.
4545
func (uo *UpdateOneOptionsBuilder) SetArrayFilters(af []interface{}) *UpdateOneOptionsBuilder {
4646
uo.Opts = append(uo.Opts, func(opts *UpdateOneOptions) error {
4747
opts.ArrayFilters = af
@@ -54,7 +54,6 @@ func (uo *UpdateOneOptionsBuilder) SetArrayFilters(af []interface{}) *UpdateOneO
5454

5555
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
5656
// writes executed as part of the operation will opt out of document-level validation on the server.
57-
// This option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
5857
// The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for
5958
// more information about document validation.
6059
func (uo *UpdateOneOptionsBuilder) SetBypassDocumentValidation(b bool) *UpdateOneOptionsBuilder {
@@ -67,10 +66,9 @@ func (uo *UpdateOneOptionsBuilder) SetBypassDocumentValidation(b bool) *UpdateOn
6766
return uo
6867
}
6968

70-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
71-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For
72-
// previous server versions, the driver will return an error if this option is used. The default
73-
// value is nil, which means the default collation of the collection will be used.
69+
// SetCollation sets the value for the Collation field. Specifies a collation to
70+
// use for string comparisons during the operation. The default value is nil,
71+
// which means the default collation of the collection will be used.
7472
func (uo *UpdateOneOptionsBuilder) SetCollation(c *Collation) *UpdateOneOptionsBuilder {
7573
uo.Opts = append(uo.Opts, func(opts *UpdateOneOptions) error {
7674
opts.Collation = c
@@ -94,13 +92,14 @@ func (uo *UpdateOneOptionsBuilder) SetComment(comment interface{}) *UpdateOneOpt
9492
return uo
9593
}
9694

97-
// SetHint sets the value for the Hint field. Specifies the index to use for the operation. This
98-
// should either be the index name as a string or the index specification as a document. This
99-
// option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return an error
100-
// if this option is specified. For server versions < 3.4, the driver will return a client-side
101-
// error if this option is specified. The driver will return an error if this option is specified
102-
// during an unacknowledged write operation. The driver will return an error if the hint parameter
103-
// is a multi-key map. The default value is nil, which means that no hint will be sent.
95+
// SetHint sets the value for the Hint field. Specifies the index to use for the
96+
// operation. This should either be the index name as a string or the index
97+
// specification as a document. This option is only valid for MongoDB versions
98+
// >= 4.2. Server versions < 4.2 will return an error if this option is
99+
// specified. The driver will return an error if this option is specified during
100+
// an unacknowledged write operation. The driver will return an error if the
101+
// hint parameter is a multi-key map. The default value is nil, which means that
102+
// no hint will be sent.
104103
func (uo *UpdateOneOptionsBuilder) SetHint(h interface{}) *UpdateOneOptionsBuilder {
105104
uo.Opts = append(uo.Opts, func(opts *UpdateOneOptions) error {
106105
opts.Hint = h
@@ -184,10 +183,10 @@ func (uo *UpdateManyOptionsBuilder) List() []func(*UpdateManyOptions) error {
184183
return uo.Opts
185184
}
186185

187-
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a set of filters
188-
// specifying to which array elements an update should apply. This option is only valid for MongoDB
189-
// versions >= 3.6. For previous server versions, the driver will return an error if this option is
190-
// used. The default value is nil, which means the update will apply to all array elements.
186+
// SetArrayFilters sets the value for the ArrayFilters field. ArrayFilters is a
187+
// set of filters specifying to which array elements an update should apply. The
188+
// default value is nil, which means the update will apply to all array
189+
// elements.
191190
func (uo *UpdateManyOptionsBuilder) SetArrayFilters(af []interface{}) *UpdateManyOptionsBuilder {
192191
uo.Opts = append(uo.Opts, func(opts *UpdateManyOptions) error {
193192
opts.ArrayFilters = af
@@ -200,7 +199,6 @@ func (uo *UpdateManyOptionsBuilder) SetArrayFilters(af []interface{}) *UpdateMan
200199

201200
// SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true,
202201
// writes executed as part of the operation will opt out of document-level validation on the server.
203-
// This option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions.
204202
// The default value is false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for
205203
// more information about document validation.
206204
func (uo *UpdateManyOptionsBuilder) SetBypassDocumentValidation(b bool) *UpdateManyOptionsBuilder {
@@ -213,10 +211,9 @@ func (uo *UpdateManyOptionsBuilder) SetBypassDocumentValidation(b bool) *UpdateM
213211
return uo
214212
}
215213

216-
// SetCollation sets the value for the Collation field. Specifies a collation to use for string
217-
// comparisons during the operation. This option is only valid for MongoDB versions >= 3.4. For
218-
// previous server versions, the driver will return an error if this option is used. The default
219-
// value is nil, which means the default collation of the collection will be used.
214+
// SetCollation sets the value for the Collation field. Specifies a collation to
215+
// use for string comparisons during the operation. The default value is nil,
216+
// which means the default collation of the collection will be used.
220217
func (uo *UpdateManyOptionsBuilder) SetCollation(c *Collation) *UpdateManyOptionsBuilder {
221218
uo.Opts = append(uo.Opts, func(opts *UpdateManyOptions) error {
222219
opts.Collation = c
@@ -240,13 +237,14 @@ func (uo *UpdateManyOptionsBuilder) SetComment(comment interface{}) *UpdateManyO
240237
return uo
241238
}
242239

243-
// SetHint sets the value for the Hint field. Specifies the index to use for the operation. This
244-
// should either be the index name as a string or the index specification as a document. This
245-
// option is only valid for MongoDB versions >= 4.2. Server versions >= 3.4 will return an error
246-
// if this option is specified. For server versions < 3.4, the driver will return a client-side
247-
// error if this option is specified. The driver will return an error if this option is specified
248-
// during an unacknowledged write operation. The driver will return an error if the hint parameter
249-
// is a multi-key map. The default value is nil, which means that no hint will be sent.
240+
// SetHint sets the value for the Hint field. Specifies the index to use for the
241+
// operation. This should either be the index name as a string or the index
242+
// specification as a document. This option is only valid for MongoDB versions
243+
// >= 4.2. Server versions < 4.2 will return an error if this option is
244+
// specified. The driver will return an error if this option is specified during
245+
// an unacknowledged write operation. The driver will return an error if the
246+
// hint parameter is a multi-key map. The default value is nil, which means that
247+
// no hint will be sent.
250248
func (uo *UpdateManyOptionsBuilder) SetHint(h interface{}) *UpdateManyOptionsBuilder {
251249
uo.Opts = append(uo.Opts, func(opts *UpdateManyOptions) error {
252250
opts.Hint = h

‎mongo/results.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,10 @@ type CollectionSpecification struct {
220220
// The type of the collection. This will either be "collection" or "view".
221221
Type string
222222

223-
// Whether or not the collection is readOnly. This will be false for MongoDB versions < 3.4.
223+
// Whether or not the collection is readOnly.
224224
ReadOnly bool
225225

226-
// The collection UUID. This field will be nil for MongoDB versions < 3.6. For versions 3.6 and higher, this will
227-
// be a bson.Binary with Subtype 4.
226+
// The collection UUID as a bson.Binary with subtype 4.
228227
UUID *bson.Binary
229228

230229
// A document containing the options used to construct the collection.

‎x/mongo/driver/operation/aggregate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (a *Aggregate) BypassDocumentValidation(bypassDocumentValidation bool) *Agg
198198
return a
199199
}
200200

201-
// Collation specifies a collation. This option is only valid for server versions 3.4 and above.
201+
// Collation specifies a collation.
202202
func (a *Aggregate) Collation(collation bsoncore.Document) *Aggregate {
203203
if a == nil {
204204
a = new(Aggregate)

‎x/mongo/driver/operation/create.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (c *Create) Capped(capped bool) *Create {
151151
return c
152152
}
153153

154-
// Collation specifies a collation. This option is only valid for server versions 3.4 and above.
154+
// Collation specifies a collation.
155155
func (c *Create) Collation(collation bsoncore.Document) *Create {
156156
if c == nil {
157157
c = new(Create)

‎x/mongo/driver/operation/delete.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ func (d *Delete) Retry(retry driver.RetryMode) *Delete {
277277
}
278278

279279
// Hint is a flag to indicate that the update document contains a hint. Hint is only supported by
280-
// servers >= 4.4. Older servers >= 3.4 will report an error for using the hint option. For servers <
281-
// 3.4, the driver will return an error if the hint option is used.
280+
// servers >= 4.4. Older servers will report an error for using the hint option.
282281
func (d *Delete) Hint(hint bool) *Delete {
283282
if d == nil {
284283
d = new(Delete)

‎x/mongo/driver/operation/update.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ func (u *Update) command(dst []byte, desc description.SelectedServer) ([]byte, e
207207
return dst, nil
208208
}
209209

210-
// BypassDocumentValidation allows the operation to opt-out of document level validation. Valid
211-
// for server versions >= 3.2. For servers < 3.2, this setting is ignored.
210+
// BypassDocumentValidation allows the operation to opt-out of document level validation.
212211
func (u *Update) BypassDocumentValidation(bypassDocumentValidation bool) *Update {
213212
if u == nil {
214213
u = new(Update)
@@ -219,8 +218,7 @@ func (u *Update) BypassDocumentValidation(bypassDocumentValidation bool) *Update
219218
}
220219

221220
// Hint is a flag to indicate that the update document contains a hint. Hint is only supported by
222-
// servers >= 4.2. Older servers >= 3.4 will report an error for using the hint option. For servers <
223-
// 3.4, the driver will return an error if the hint option is used.
221+
// servers >= 4.2. Older servers will report an error for using the hint option.
224222
func (u *Update) Hint(hint bool) *Update {
225223
if u == nil {
226224
u = new(Update)
@@ -230,8 +228,7 @@ func (u *Update) Hint(hint bool) *Update {
230228
return u
231229
}
232230

233-
// ArrayFilters is a flag to indicate that the update document contains an arrayFilters field. This option is only
234-
// supported on server versions 3.6 and higher. For servers < 3.6, the driver will return an error.
231+
// ArrayFilters is a flag to indicate that the update document contains an arrayFilters field.
235232
func (u *Update) ArrayFilters(arrayFilters bool) *Update {
236233
if u == nil {
237234
u = new(Update)

‎x/mongo/driver/topology/fsm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
var (
2222
// MinSupportedMongoDBVersion is the version string for the lowest MongoDB version supported by the driver.
23-
MinSupportedMongoDBVersion = "3.6"
23+
MinSupportedMongoDBVersion = "4.0"
2424

2525
// SupportedWireVersions is the range of wire versions supported by the driver.
2626
SupportedWireVersions = driverutil.NewVersionRange(driverutil.MinWireVersion, driverutil.MaxWireVersion)

‎x/mongo/driver/topology/topology_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func TestServerSelection(t *testing.T) {
114114
}
115115
want := fmt.Errorf(
116116
"server at %s reports wire version %d, but this version of the Go driver requires "+
117-
"at least 6 (MongoDB 3.6)",
117+
"at least 7 (MongoDB 4.0)",
118118
desc.Servers[0].Addr.String(),
119119
desc.Servers[0].WireVersion.Max,
120120
)

0 commit comments

Comments
 (0)
Please sign in to comment.