Skip to content

Commit 09c8792

Browse files
authored
RUST-247: Add collation option to find_one (#100)
1 parent d9e4ae5 commit 09c8792

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/coll/options.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ impl From<FindOneOptions> for FindOptions {
693693
fn from(options: FindOneOptions) -> Self {
694694
FindOptions {
695695
allow_partial_results: options.allow_partial_results,
696+
collation: options.collation,
696697
comment: options.comment,
697698
hint: options.hint,
698699
max: options.max,
@@ -705,7 +706,12 @@ impl From<FindOneOptions> for FindOptions {
705706
selection_criteria: options.selection_criteria,
706707
show_record_id: options.show_record_id,
707708
skip: options.skip,
708-
..Default::default()
709+
batch_size: None,
710+
cursor_type: None,
711+
limit: None,
712+
max_await_time: None,
713+
no_cursor_timeout: None,
714+
sort: None,
709715
}
710716
}
711717
}
@@ -733,6 +739,13 @@ pub struct FindOneOptions {
733739
#[builder(default)]
734740
pub allow_partial_results: Option<bool>,
735741

742+
/// The collation to use for the operation.
743+
///
744+
/// See the [documentation](https://docs.mongodb.com/manual/reference/collation/) for more
745+
/// information on how to use this option.
746+
#[builder(default)]
747+
pub collation: Option<Collation>,
748+
736749
/// Tags the query with an arbitrary string to help trace the operation through the database
737750
/// profiler, currentOp and logs.
738751
#[builder(default)]

0 commit comments

Comments
 (0)