@@ -15,6 +15,7 @@ use crate::{
15
15
/// These are the valid options for creating a [`Collection`](../struct.Collection.html) with
16
16
/// [`Database::collection_with_options`](../struct.Database.html#method.collection_with_options).
17
17
#[ derive( Debug , Default , TypedBuilder ) ]
18
+ #[ non_exhaustive]
18
19
pub struct CollectionOptions {
19
20
/// The default read preference for operations.
20
21
#[ builder( default ) ]
@@ -34,6 +35,7 @@ pub struct CollectionOptions {
34
35
/// [`Collection::find_one_and_update`](../struct.Collection.html#method.find_one_and_update)
35
36
/// operation should return the document before or after modification.
36
37
#[ derive( Debug ) ]
38
+ #[ non_exhaustive]
37
39
pub enum ReturnDocument {
38
40
/// Return the document after modification.
39
41
After ,
@@ -44,6 +46,7 @@ pub enum ReturnDocument {
44
46
/// Specifies the index to use for an operation.
45
47
#[ derive( Clone , Debug , Deserialize , Serialize ) ]
46
48
#[ serde( untagged) ]
49
+ #[ non_exhaustive]
47
50
pub enum Hint {
48
51
/// Specifies the keys of the index to use.
49
52
Keys ( Document ) ,
@@ -62,6 +65,7 @@ impl Hint {
62
65
63
66
/// Specifies the type of cursor to return from a find operation.
64
67
#[ derive( Debug , Clone , Copy ) ]
68
+ #[ non_exhaustive]
65
69
pub enum CursorType {
66
70
/// Default; close the cursor after the last document is received from the server.
67
71
NonTailable ,
@@ -78,6 +82,7 @@ pub enum CursorType {
78
82
/// Specifies the options to a
79
83
/// [`Collection::insert_one`](../struct.Collection.html#method.insert_one) operation.
80
84
#[ derive( Clone , Debug , Default , TypedBuilder ) ]
85
+ #[ non_exhaustive]
81
86
pub struct InsertOneOptions {
82
87
/// Opt out of document-level validation.
83
88
#[ builder( default ) ]
@@ -93,6 +98,7 @@ pub struct InsertOneOptions {
93
98
#[ skip_serializing_none]
94
99
#[ derive( Clone , Debug , Default , TypedBuilder , Serialize , Deserialize ) ]
95
100
#[ serde( rename_all = "camelCase" ) ]
101
+ #[ non_exhaustive]
96
102
pub struct InsertManyOptions {
97
103
/// Opt out of document-level validation.
98
104
#[ builder( default ) ]
@@ -126,6 +132,7 @@ impl InsertManyOptions {
126
132
/// [documentation](https://docs.mongodb.com/manual/reference/command/update/#update-command-behaviors)
127
133
#[ derive( Clone , Debug , Serialize ) ]
128
134
#[ serde( untagged) ]
135
+ #[ non_exhaustive]
129
136
pub enum UpdateModifications {
130
137
/// A document that contains only update operator expressions.
131
138
Document ( Document ) ,
@@ -162,6 +169,7 @@ impl From<Vec<Document>> for UpdateModifications {
162
169
/// [`Collection::update_one`](../struct.Collection.html#method.update_one) or
163
170
/// [`Collection::update_many`](../struct.Collection.html#method.update_many) operation.
164
171
#[ derive( Debug , Default , TypedBuilder ) ]
172
+ #[ non_exhaustive]
165
173
pub struct UpdateOptions {
166
174
/// A set of filters specifying to which array elements an update should apply.
167
175
///
@@ -213,6 +221,7 @@ impl UpdateOptions {
213
221
/// Specifies the options to a
214
222
/// [`Collection::replace_one`](../struct.Collection.html#method.replace_one) operation.
215
223
#[ derive( Debug , Default , TypedBuilder ) ]
224
+ #[ non_exhaustive]
216
225
pub struct ReplaceOptions {
217
226
/// Opt out of document-level validation.
218
227
#[ builder( default ) ]
@@ -247,6 +256,7 @@ pub struct ReplaceOptions {
247
256
#[ serde_with:: skip_serializing_none]
248
257
#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
249
258
#[ serde( rename_all = "camelCase" ) ]
259
+ #[ non_exhaustive]
250
260
pub struct DeleteOptions {
251
261
/// The collation to use for the operation.
252
262
///
@@ -264,6 +274,7 @@ pub struct DeleteOptions {
264
274
/// [`Collection::find_one_and_delete`](../struct.Collection.html#method.find_one_and_delete)
265
275
/// operation.
266
276
#[ derive( Debug , Default , TypedBuilder ) ]
277
+ #[ non_exhaustive]
267
278
pub struct FindOneAndDeleteOptions {
268
279
/// The maximum amount of time to allow the query to run.
269
280
///
@@ -296,6 +307,7 @@ pub struct FindOneAndDeleteOptions {
296
307
/// [`Collection::find_one_and_replace`](../struct.Collection.html#method.find_one_and_replace)
297
308
/// operation.
298
309
#[ derive( Debug , Default , TypedBuilder ) ]
310
+ #[ non_exhaustive]
299
311
pub struct FindOneAndReplaceOptions {
300
312
/// Opt out of document-level validation.
301
313
#[ builder( default ) ]
@@ -340,6 +352,7 @@ pub struct FindOneAndReplaceOptions {
340
352
/// [`Collection::find_one_and_update`](../struct.Collection.html#method.find_one_and_update)
341
353
/// operation.
342
354
#[ derive( Debug , Default , TypedBuilder ) ]
355
+ #[ non_exhaustive]
343
356
pub struct FindOneAndUpdateOptions {
344
357
/// A set of filters specifying to which array elements an update should apply.
345
358
///
@@ -392,6 +405,7 @@ pub struct FindOneAndUpdateOptions {
392
405
#[ skip_serializing_none]
393
406
#[ serde( rename_all = "camelCase" ) ]
394
407
#[ derive( Clone , Debug , Default , TypedBuilder , Serialize ) ]
408
+ #[ non_exhaustive]
395
409
pub struct AggregateOptions {
396
410
/// Enables writing to temporary files. When set to true, aggregation stages can write data to
397
411
/// the _tmp subdirectory in the dbPath directory.
@@ -473,6 +487,7 @@ pub struct AggregateOptions {
473
487
/// Specifies the options to a
474
488
/// [`Collection::count_documents`](../struct.Collection.html#method.count_documents) operation.
475
489
#[ derive( Debug , Default , TypedBuilder ) ]
490
+ #[ non_exhaustive]
476
491
pub struct CountOptions {
477
492
/// The index to use for the operation.
478
493
#[ builder( default ) ]
@@ -511,6 +526,7 @@ pub struct CountOptions {
511
526
#[ serde_with:: skip_serializing_none]
512
527
#[ derive( Debug , Default , TypedBuilder , Serialize , Clone ) ]
513
528
#[ serde( rename_all = "camelCase" ) ]
529
+ #[ non_exhaustive]
514
530
pub struct EstimatedDocumentCountOptions {
515
531
/// The maximum amount of time to allow the query to run.
516
532
///
@@ -540,6 +556,7 @@ pub struct EstimatedDocumentCountOptions {
540
556
#[ serde_with:: skip_serializing_none]
541
557
#[ derive( Debug , Default , TypedBuilder , Serialize , Clone ) ]
542
558
#[ serde( rename_all = "camelCase" ) ]
559
+ #[ non_exhaustive]
543
560
pub struct DistinctOptions {
544
561
/// The maximum amount of time to allow the query to run.
545
562
///
@@ -576,6 +593,7 @@ pub struct DistinctOptions {
576
593
#[ skip_serializing_none]
577
594
#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
578
595
#[ serde( rename_all = "camelCase" ) ]
596
+ #[ non_exhaustive]
579
597
pub struct FindOptions {
580
598
/// Enables writing to temporary files by the server. When set to true, the find operation can
581
599
/// write data to the _tmp subdirectory in the dbPath directory. Only supported in server
@@ -741,6 +759,7 @@ where
741
759
/// Specifies the options to a [`Collection::find_one`](../struct.Collection.html#method.find_one)
742
760
/// operation.
743
761
#[ derive( Debug , Default , TypedBuilder ) ]
762
+ #[ non_exhaustive]
744
763
pub struct FindOneOptions {
745
764
/// If true, partial results will be returned from a mongos rather than an error being
746
765
/// returned if one or more shards is down.
@@ -820,6 +839,7 @@ pub struct FindOneOptions {
820
839
821
840
/// Specifies an index to create.
822
841
#[ derive( Debug , TypedBuilder ) ]
842
+ #[ non_exhaustive]
823
843
pub struct IndexModel {
824
844
/// The fields to index, along with their sort order.
825
845
pub keys : Document ,
@@ -833,6 +853,7 @@ pub struct IndexModel {
833
853
/// operation.
834
854
#[ derive( Debug , Default , TypedBuilder , Serialize ) ]
835
855
#[ serde( rename_all = "camelCase" ) ]
856
+ #[ non_exhaustive]
836
857
pub struct DropCollectionOptions {
837
858
/// The write concern for the operation.
838
859
#[ builder( default ) ]
0 commit comments