Skip to content

Commit 9445acd

Browse files
committed
update comments.
1 parent 24db535 commit 9445acd

File tree

6 files changed

+33
-24
lines changed

6 files changed

+33
-24
lines changed

mongo/bulk_write_models.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ func (rom *ReplaceOneModel) SetUpsert(upsert bool) *ReplaceOneModel {
183183
}
184184

185185
// SetSort specifies which document the operation replaces if the query matches multiple documents. The first document
186-
// matched by the sort order will be replaced. This option is only valid for MongoDB versions >= 8.0. The driver will
187-
// return an error if the sort parameter is a multi-key map. The default value is nil.
186+
// matched by the sort order will be replaced. This option is only valid for MongoDB versions >= 8.0. The sort parameter
187+
// is evaluated sequentially, so the driver will return an error if it is a multi-key map (which is unordeded). The
188+
// default value is nil.
188189
func (rom *ReplaceOneModel) SetSort(sort interface{}) *ReplaceOneModel {
189190
rom.Sort = sort
190191
return rom
@@ -259,8 +260,9 @@ func (uom *UpdateOneModel) SetUpsert(upsert bool) *UpdateOneModel {
259260
}
260261

261262
// SetSort specifies which document the operation updates if the query matches multiple documents. The first document
262-
// matched by the sort order will be updated. This option is only valid for MongoDB versions >= 8.0. The driver will
263-
// return an error if the sort parameter is a multi-key map. The default value is nil.
263+
// matched by the sort order will be updated. This option is only valid for MongoDB versions >= 8.0. The sort parameter
264+
// is evaluated sequentially, so the driver will return an error if it is a multi-key map (which is unordeded). The
265+
// default value is nil.
264266
func (uom *UpdateOneModel) SetSort(sort interface{}) *UpdateOneModel {
265267
uom.Sort = sort
266268
return uom

mongo/client_bulk_write_models.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ func (uom *ClientUpdateOneModel) SetUpsert(upsert bool) *ClientUpdateOneModel {
107107
}
108108

109109
// SetSort specifies which document the operation updates if the query matches multiple documents. The first document
110-
// matched by the sort order will be updated. This option is only valid for MongoDB versions >= 8.0. The driver will
111-
// return an error if the sort parameter is a multi-key map. The default value is nil.
110+
// matched by the sort order will be updated. This option is only valid for MongoDB versions >= 8.0. The sort parameter
111+
// is evaluated sequentially, so the driver will return an error if it is a multi-key map (which is unordeded). The
112+
// default value is nil.
112113
func (uom *ClientUpdateOneModel) SetSort(sort interface{}) *ClientUpdateOneModel {
113114
uom.Sort = sort
114115
return uom
@@ -233,8 +234,9 @@ func (rom *ClientReplaceOneModel) SetUpsert(upsert bool) *ClientReplaceOneModel
233234
}
234235

235236
// SetSort specifies which document the operation replaces if the query matches multiple documents. The first document
236-
// matched by the sort order will be replaced. This option is only valid for MongoDB versions >= 8.0. The driver will
237-
// return an error if the sort parameter is a multi-key map. The default value is nil.
237+
// matched by the sort order will be replaced. This option is only valid for MongoDB versions >= 8.0. The sort parameter
238+
// is evaluated sequentially, so the driver will return an error if it is a multi-key map (which is unordeded). The
239+
// default value is nil.
238240
func (rom *ClientReplaceOneModel) SetSort(sort interface{}) *ClientReplaceOneModel {
239241
rom.Sort = sort
240242
return rom

mongo/options/findoptions.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ func (f *FindOptionsBuilder) SetSkip(i int64) *FindOptionsBuilder {
258258
}
259259

260260
// SetSort sets the value for the Sort field. Sort is a document specifying the order in which
261-
// documents should be returned. The driver will return an error if the sort parameter is a
262-
// multi-key map.
261+
// documents should be returned. The sort parameter is evaluated sequentially, so the driver will
262+
// return an error if it is a multi-key map (which is unordeded). The default value is nil.
263263
func (f *FindOptionsBuilder) SetSort(sort interface{}) *FindOptionsBuilder {
264264
f.Opts = append(f.Opts, func(opts *FindOptions) error {
265265
opts.Sort = sort
@@ -426,8 +426,9 @@ func (f *FindOneOptionsBuilder) SetSkip(i int64) *FindOneOptionsBuilder {
426426
}
427427

428428
// SetSort sets the value for the Sort field. Sets a document specifying the sort order to
429-
// apply to the query. The first document in the sorted order will be returned. The driver
430-
// will return an error if the sort parameter is a multi-key map.
429+
// apply to the query. The first document in the sorted order will be returned. The sort
430+
// parameter is evaluated sequentially, so the driver will return an error if it is a multi-
431+
// key map (which is unordeded). The default value is nil.
431432
func (f *FindOneOptionsBuilder) SetSort(sort interface{}) *FindOneOptionsBuilder {
432433
f.Opts = append(f.Opts, func(opts *FindOneOptions) error {
433434
opts.Sort = sort
@@ -539,8 +540,9 @@ func (f *FindOneAndReplaceOptionsBuilder) SetReturnDocument(rd ReturnDocument) *
539540

540541
// SetSort sets the value for the Sort field. Sets a document specifying which document should
541542
// be replaced if the filter used by the operation matches multiple documents in the collection.
542-
// If set, the first document in the sorted order will be replaced. The driver will return an
543-
// error if the sort parameter is a multi-key map. The default value is nil.
543+
// If set, the first document in the sorted order will be replaced. The sort parameter is evaluated
544+
// sequentially, so the driver will return an error if it is a multi-key map (which is unordeded).
545+
// The default value is nil.
544546
func (f *FindOneAndReplaceOptionsBuilder) SetSort(sort interface{}) *FindOneAndReplaceOptionsBuilder {
545547
f.Opts = append(f.Opts, func(opts *FindOneAndReplaceOptions) error {
546548
opts.Sort = sort
@@ -716,8 +718,9 @@ func (f *FindOneAndUpdateOptionsBuilder) SetReturnDocument(rd ReturnDocument) *F
716718

717719
// SetSort sets the value for the Sort field. Sets a document specifying which document should
718720
// be updated if the filter used by the operation matches multiple documents in the collection.
719-
// If set, the first document in the sorted order will be updated. The driver will return an
720-
// error if the sort parameter is a multi-key map. The default value is nil.
721+
// If set, the first document in the sorted order will be updated. The sort parameter is evaluated
722+
// sequentially, so the driver will return an error if it is a multi-key map (which is unordeded).
723+
// The default value is nil.
721724
func (f *FindOneAndUpdateOptionsBuilder) SetSort(sort interface{}) *FindOneAndUpdateOptionsBuilder {
722725
f.Opts = append(f.Opts, func(opts *FindOneAndUpdateOptions) error {
723726
opts.Sort = sort
@@ -846,8 +849,9 @@ func (f *FindOneAndDeleteOptionsBuilder) SetProjection(projection interface{}) *
846849

847850
// SetSort sets the value for the Sort field. Sets a document specifying which document should
848851
// be replaced if the filter used by the operation matches multiple documents in the collection.
849-
// If set, the first document in the sorted order will be selected for replacement. The driver
850-
// will return an error if the sort parameter is a multi-key map. The default value is nil.
852+
// If set, the first document in the sorted order will be deleted. The sort parameter is evaluated
853+
// sequentially, so the driver will return an error if it is a multi-key map (which is unordeded).
854+
// The default value is nil.
851855
func (f *FindOneAndDeleteOptionsBuilder) SetSort(sort interface{}) *FindOneAndDeleteOptionsBuilder {
852856
f.Opts = append(f.Opts, func(opts *FindOneAndDeleteOptions) error {
853857
opts.Sort = sort

mongo/options/gridfsoptions.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,9 @@ func (f *GridFSFindOptionsBuilder) SetSkip(i int32) *GridFSFindOptionsBuilder {
328328
}
329329

330330
// SetSort sets the value for the Sort field. Sets a document specifying the order
331-
// in which documents should be returned. The driver will return an error if the
332-
// sort parameter is a multi-key map.
331+
// in which documents should be returned. The sort parameter is evaluated sequentially,
332+
// so the driver will return an error if it is a multi-key map (which is unordeded).
333+
// The default value is nil.
333334
func (f *GridFSFindOptionsBuilder) SetSort(sort interface{}) *GridFSFindOptionsBuilder {
334335
f.Opts = append(f.Opts, func(opts *GridFSFindOptions) error {
335336
opts.Sort = sort

mongo/options/replaceoptions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ func (ro *ReplaceOptionsBuilder) SetLet(l interface{}) *ReplaceOptionsBuilder {
127127
// SetSort sets the value for the Sort field. Specifies a document specifying which document should
128128
// be replaced if the filter used by the operation matches multiple documents in the collection. If
129129
// set, the first document in the sorted order will be replaced. This option is only valid for MongoDB
130-
// versions >= 8.0. The driver will return an error if the sort parameter is a multi-key map. The
131-
// default value is nil.
130+
// versions >= 8.0. The sort parameter is evaluated sequentially, so the driver will return an error
131+
// if it is a multi-key map (which is unordeded). The default value is nil.
132132
func (ro *ReplaceOptionsBuilder) SetSort(s interface{}) *ReplaceOptionsBuilder {
133133
ro.Opts = append(ro.Opts, func(opts *ReplaceOptions) error {
134134
opts.Sort = s

mongo/options/updateoptions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ func (uo *UpdateOneOptionsBuilder) SetLet(l interface{}) *UpdateOneOptionsBuilde
141141
// SetSort sets the value for the Sort field. Specifies a document specifying which document should
142142
// be updated if the filter used by the operation matches multiple documents in the collection. If
143143
// set, the first document in the sorted order will be updated. This option is only valid for MongoDB
144-
// versions >= 8.0. The driver will return an error if the sort parameter is a multi-key map. The
145-
// default value is nil.
144+
// versions >= 8.0. The sort parameter is evaluated sequentially, so the driver will return an error
145+
// if it is a multi-key map (which is unordeded). The default value is nil.
146146
func (uo *UpdateOneOptionsBuilder) SetSort(s interface{}) *UpdateOneOptionsBuilder {
147147
uo.Opts = append(uo.Opts, func(opts *UpdateOneOptions) error {
148148
opts.Sort = s

0 commit comments

Comments
 (0)