Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cc8b4f4

Browse files
committedMar 12, 2025··
GODRIVER-3098 Drop support for MongoDB 3.6
1 parent e0de429 commit cc8b4f4

27 files changed

+177
-265
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.22 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

+2-4
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ func (db *Database) Collection(name string, opts ...options.Lister[options.Colle
115115
return newCollection(db, name, opts...)
116116
}
117117

118-
// Aggregate executes an aggregate command the database. This requires MongoDB version >= 3.6 and driver version >=
119-
// 1.1.0.
118+
// Aggregate executes an aggregate command the database.
120119
//
121120
// The pipeline parameter must be a slice of documents, each representing an aggregation stage. The pipeline
122121
// cannot be nil but can be empty. The stage documents must all be non-nil. For a pipeline of bson.D documents, the
@@ -874,8 +873,7 @@ func (db *Database) createCollectionOperation(
874873
}
875874

876875
// CreateView executes a create command to explicitly create a view on the server. See
877-
// https://www.mongodb.com/docs/manual/core/views/ for more information about views. This method requires driver version >=
878-
// 1.4.0 and MongoDB version >= 3.4.
876+
// https://www.mongodb.com/docs/manual/core/views/ for more information about views.
879877
//
880878
// The viewName parameter specifies the name of the view to create.
881879
//

‎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

0 commit comments

Comments
 (0)
Please sign in to comment.