@@ -309,6 +309,8 @@ type FindOneOptions struct {
309
309
AllowPartialResults * bool
310
310
311
311
// The maximum number of documents to be included in each batch returned by the server.
312
+ //
313
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
312
314
BatchSize * int32
313
315
314
316
// Specifies a collation to use for string comparisons during the operation. This option is only valid for MongoDB
@@ -322,6 +324,8 @@ type FindOneOptions struct {
322
324
323
325
// Specifies the type of cursor that should be created for the operation. The default is NonTailable, which means
324
326
// that the cursor will be closed by the server when the last batch of documents is retrieved.
327
+ //
328
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
325
329
CursorType * CursorType
326
330
327
331
// The index to use for the aggregation. This should either be the index name as a string or the index specification
@@ -336,6 +340,8 @@ type FindOneOptions struct {
336
340
// The maximum amount of time that the server should wait for new documents to satisfy a tailable cursor query.
337
341
// This option is only valid for tailable await cursors (see the CursorType option for more information) and
338
342
// MongoDB versions >= 3.2. For other cursor types or previous server versions, this option is ignored.
343
+ //
344
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
339
345
MaxAwaitTime * time.Duration
340
346
341
347
// The maximum amount of time that the query can run on the server. The default value is nil, meaning that there
@@ -348,9 +354,14 @@ type FindOneOptions struct {
348
354
349
355
// If true, the cursor created by the operation will not timeout after a period of inactivity. The default value
350
356
// is false.
357
+ //
358
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
351
359
NoCursorTimeout * bool
352
360
353
361
// This option is for internal replication use only and should not be set.
362
+ //
363
+ // Deprecated: This option has been deprecated in MongoDB version 4.4 and will be ignored by the server if it is
364
+ // set.
354
365
OplogReplay * bool
355
366
356
367
// A document describing which fields will be included in the document returned by the operation. The default value
@@ -391,6 +402,8 @@ func (f *FindOneOptions) SetAllowPartialResults(b bool) *FindOneOptions {
391
402
}
392
403
393
404
// SetBatchSize sets the value for the BatchSize field.
405
+ //
406
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
394
407
func (f * FindOneOptions ) SetBatchSize (i int32 ) * FindOneOptions {
395
408
f .BatchSize = & i
396
409
return f
@@ -409,6 +422,8 @@ func (f *FindOneOptions) SetComment(comment string) *FindOneOptions {
409
422
}
410
423
411
424
// SetCursorType sets the value for the CursorType field.
425
+ //
426
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
412
427
func (f * FindOneOptions ) SetCursorType (ct CursorType ) * FindOneOptions {
413
428
f .CursorType = & ct
414
429
return f
@@ -427,6 +442,8 @@ func (f *FindOneOptions) SetMax(max interface{}) *FindOneOptions {
427
442
}
428
443
429
444
// SetMaxAwaitTime sets the value for the MaxAwaitTime field.
445
+ //
446
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
430
447
func (f * FindOneOptions ) SetMaxAwaitTime (d time.Duration ) * FindOneOptions {
431
448
f .MaxAwaitTime = & d
432
449
return f
@@ -445,12 +462,17 @@ func (f *FindOneOptions) SetMin(min interface{}) *FindOneOptions {
445
462
}
446
463
447
464
// SetNoCursorTimeout sets the value for the NoCursorTimeout field.
465
+ //
466
+ // Deprecated: This option is not valid for a findOne operation, as no cursor is actually created.
448
467
func (f * FindOneOptions ) SetNoCursorTimeout (b bool ) * FindOneOptions {
449
468
f .NoCursorTimeout = & b
450
469
return f
451
470
}
452
471
453
472
// SetOplogReplay sets the value for the OplogReplay field.
473
+ //
474
+ // Deprecated: This option has been deprecated in MongoDB version 4.4 and will be ignored by the server if it is
475
+ // set.
454
476
func (f * FindOneOptions ) SetOplogReplay (b bool ) * FindOneOptions {
455
477
f .OplogReplay = & b
456
478
return f
0 commit comments