@@ -12,8 +12,8 @@ use crate::{
1212 selection_criteria:: SelectionCriteria ,
1313} ;
1414
15- /// These are the valid options for creating a `Collection` with
16- /// `Database::collection_with_options`.
15+ /// These are the valid options for creating a [ `Collection`](../struct.Collection.html) with
16+ /// [ `Database::collection_with_options`](../struct.Database.html#method.collection_with_options) .
1717#[ derive( Debug , Default , TypedBuilder ) ]
1818pub struct CollectionOptions {
1919 /// The default read preference for operations.
@@ -29,7 +29,9 @@ pub struct CollectionOptions {
2929 pub write_concern : Option < WriteConcern > ,
3030}
3131
32- /// Specifies whether a `Collection::find_one_and_replace` and `Collection::find_one_and_update`
32+ /// Specifies whether a
33+ /// [`Collection::find_one_and_replace`](../struct.Collection.html#method.find_one_and_replace) and
34+ /// [`Collection::find_one_and_update`](../struct.Collection.html#method.find_one_and_update)
3335/// operation should return the document before or after modification.
3436#[ derive( Debug ) ]
3537pub enum ReturnDocument {
@@ -73,7 +75,8 @@ pub enum CursorType {
7375 TailableAwait ,
7476}
7577
76- /// Specifies the options to a `Collection::insert_one` operation.
78+ /// Specifies the options to a
79+ /// [`Collection::insert_one`](../struct.Collection.html#method.insert_one) operation.
7780#[ derive( Clone , Debug , Default , TypedBuilder ) ]
7881pub struct InsertOneOptions {
7982 /// Opt out of document-level validation.
@@ -85,7 +88,8 @@ pub struct InsertOneOptions {
8588 pub write_concern : Option < WriteConcern > ,
8689}
8790
88- /// Specifies the options to a `Collection::insert_many` operation.
91+ /// Specifies the options to a
92+ /// [`Collection::insert_many`](../struct.Collection.html#method.insert_many) operation.
8993#[ skip_serializing_none]
9094#[ derive( Clone , Debug , Default , TypedBuilder , Serialize , Deserialize ) ]
9195#[ serde( rename_all = "camelCase" ) ]
@@ -154,7 +158,9 @@ impl From<Vec<Document>> for UpdateModifications {
154158 }
155159}
156160
157- /// Specifies the options to a `Collection::update_one` or `Collection::update_many` operation.
161+ /// Specifies the options to a
162+ /// [`Collection::update_one`](../struct.Collection.html#method.update_one) or
163+ /// [`Collection::update_many`](../struct.Collection.html#method.update_many) operation.
158164#[ derive( Debug , Default , TypedBuilder ) ]
159165pub struct UpdateOptions {
160166 /// A set of filters specifying to which array elements an update should apply.
@@ -204,7 +210,8 @@ impl UpdateOptions {
204210 }
205211}
206212
207- /// Specifies the options to a `Collection::replace_one` operation.
213+ /// Specifies the options to a
214+ /// [`Collection::replace_one`](../struct.Collection.html#method.replace_one) operation.
208215#[ derive( Debug , Default , TypedBuilder ) ]
209216pub struct ReplaceOptions {
210217 /// Opt out of document-level validation.
@@ -233,7 +240,9 @@ pub struct ReplaceOptions {
233240 pub write_concern : Option < WriteConcern > ,
234241}
235242
236- /// Specifies the options to a `Collection::delete_one` or `Collection::delete_many` operation.
243+ /// Specifies the options to a
244+ /// [`Collection::delete_one`](../struct.Collection.html#method.delete_one) or
245+ /// [`Collection::delete_many`](../struct.Collection.html#method.delete_many) operation.
237246#[ serde_with:: skip_serializing_none]
238247#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
239248#[ serde( rename_all = "camelCase" ) ]
@@ -250,7 +259,9 @@ pub struct DeleteOptions {
250259 pub write_concern : Option < WriteConcern > ,
251260}
252261
253- /// Specifies the options to a `Collection::find_one_and_delete` operation.
262+ /// Specifies the options to a
263+ /// [`Collection::find_one_and_delete`](../struct.Collection.html#method.find_one_and_delete)
264+ /// operation.
254265#[ derive( Debug , Default , TypedBuilder ) ]
255266pub struct FindOneAndDeleteOptions {
256267 /// The maximum amount of time to allow the query to run.
@@ -280,7 +291,9 @@ pub struct FindOneAndDeleteOptions {
280291 pub collation : Option < Collation > ,
281292}
282293
283- /// Specifies the options to a `Collection::find_one_and_replace` operation.
294+ /// Specifies the options to a
295+ /// [`Collection::find_one_and_replace`](../struct.Collection.html#method.find_one_and_replace)
296+ /// operation.
284297#[ derive( Debug , Default , TypedBuilder ) ]
285298pub struct FindOneAndReplaceOptions {
286299 /// Opt out of document-level validation.
@@ -322,13 +335,16 @@ pub struct FindOneAndReplaceOptions {
322335 pub collation : Option < Collation > ,
323336}
324337
325- /// Specifies the options to a `Collection::find_one_and_update` operation.
338+ /// Specifies the options to a
339+ /// [`Collection::find_one_and_update`](../struct.Collection.html#method.find_one_and_update)
340+ /// operation.
326341#[ derive( Debug , Default , TypedBuilder ) ]
327342pub struct FindOneAndUpdateOptions {
328343 /// A set of filters specifying to which array elements an update should apply.
329344 ///
330345 /// See the documentation [here](https://docs.mongodb.com/manual/reference/command/update/) for
331- /// more information on array filters.#[builder(default)]
346+ /// more information on array filters.
347+ #[ builder( default ) ]
332348 pub array_filters : Option < Vec < Document > > ,
333349
334350 /// Opt out of document-level validation.
@@ -370,7 +386,8 @@ pub struct FindOneAndUpdateOptions {
370386 pub collation : Option < Collation > ,
371387}
372388
373- /// Specifies the options to a `Collection::aggregate` operation.
389+ /// Specifies the options to a [`Collection::aggregate`](../struct.Collection.html#method.aggregate)
390+ /// operation.
374391#[ skip_serializing_none]
375392#[ serde( rename_all = "camelCase" ) ]
376393#[ derive( Clone , Debug , Default , TypedBuilder , Serialize ) ]
@@ -452,7 +469,8 @@ pub struct AggregateOptions {
452469 pub write_concern : Option < WriteConcern > ,
453470}
454471
455- /// Specifies the options to a `Collection::count_documents` operation.
472+ /// Specifies the options to a
473+ /// [`Collection::count_documents`](../struct.Collection.html#method.count_documents) operation.
456474#[ derive( Debug , Default , TypedBuilder ) ]
457475pub struct CountOptions {
458476 /// The index to use for the operation.
@@ -482,7 +500,13 @@ pub struct CountOptions {
482500 pub collation : Option < Collation > ,
483501}
484502
485- /// Specifies the options to a `Collection::estimated_document_count` operation.
503+ // rustfmt tries to split the link up when it's all on one line, which breaks the link, so we wrap
504+ // the link contents in whitespace to get it to render correctly.
505+ //
506+ /// Specifies the options to a
507+ /// [
508+ /// `Collection::estimated_document_count`
509+ /// ](../struct.Collection.html#method.estimated_document_count) operation.
486510#[ serde_with:: skip_serializing_none]
487511#[ derive( Debug , Default , TypedBuilder , Serialize , Clone ) ]
488512#[ serde( rename_all = "camelCase" ) ]
@@ -498,16 +522,20 @@ pub struct EstimatedDocumentCountOptions {
498522 ) ]
499523 pub max_time : Option < Duration > ,
500524
525+ /// The criteria used to select a server for this operation.
526+ ///
527+ /// If none specified, the default set on the collection will be used.
501528 #[ builder( default ) ]
502529 #[ serde( skip_serializing) ]
503530 pub selection_criteria : Option < SelectionCriteria > ,
504531
505- /// The level of the read concern
532+ /// The level of the read concern.
506533 #[ builder( default ) ]
507534 pub read_concern : Option < ReadConcern > ,
508535}
509536
510- /// Specifies the options to a `Collection::distinct` operation.
537+ /// Specifies the options to a [`Collection::distinct`](../struct.Collection.html#method.distinct)
538+ /// operation.
511539#[ serde_with:: skip_serializing_none]
512540#[ derive( Debug , Default , TypedBuilder , Serialize , Clone ) ]
513541#[ serde( rename_all = "camelCase" ) ]
@@ -523,11 +551,14 @@ pub struct DistinctOptions {
523551 ) ]
524552 pub max_time : Option < Duration > ,
525553
554+ /// The criteria used to select a server for this operation.
555+ ///
556+ /// If none specified, the default set on the collection will be used.
526557 #[ builder( default ) ]
527558 #[ serde( skip_serializing) ]
528559 pub selection_criteria : Option < SelectionCriteria > ,
529560
530- /// The level of the read concern
561+ /// The level of the read concern.
531562 #[ builder( default ) ]
532563 pub read_concern : Option < ReadConcern > ,
533564
@@ -539,7 +570,8 @@ pub struct DistinctOptions {
539570 pub collation : Option < Collation > ,
540571}
541572
542- /// Specifies the options to a `Collection::find` operation.
573+ /// Specifies the options to a [`Collection::find`](../struct.Collection.html#method.find)
574+ /// operation.
543575#[ skip_serializing_none]
544576#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
545577#[ serde( rename_all = "camelCase" ) ]
@@ -692,7 +724,8 @@ where
692724 }
693725}
694726
695- /// Specifies the options to a `Collection::find_one` operation.
727+ /// Specifies the options to a [`Collection::find_one`](../struct.Collection.html#method.find_one)
728+ /// operation.
696729#[ derive( Debug , Default , TypedBuilder ) ]
697730pub struct FindOneOptions {
698731 /// If true, partial results will be returned from a mongos rather than an error being
@@ -771,7 +804,8 @@ pub struct IndexModel {
771804 pub options : Option < Document > ,
772805}
773806
774- /// Specifies the options to a `Collection::drop` operation.
807+ /// Specifies the options to a [`Collection::drop`](../struct.Collection.html#method.drop)
808+ /// operation.
775809#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
776810#[ serde( rename_all = "camelCase" ) ]
777811pub struct DropCollectionOptions {
0 commit comments