#[non_exhaustive]
pub struct ChangeStreamOptions { pub full_document: Option<FullDocumentType>, pub full_document_before_change: Option<FullDocumentBeforeChangeType>, pub resume_after: Option<ResumeToken>, pub start_at_operation_time: Option<Timestamp>, pub start_after: Option<ResumeToken>, pub max_await_time: Option<Duration>, pub batch_size: Option<u32>, pub collation: Option<Collation>, pub read_concern: Option<ReadConcern>, pub selection_criteria: Option<SelectionCriteria>, /* private fields */ }
Expand description

These are the valid options that can be passed to the watch method for creating a ChangeStream.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
full_document: Option<FullDocumentType>

Configures how the ChangeStreamEvent::full_document field will be populated. By default, the field will be empty for updates.

full_document_before_change: Option<FullDocumentBeforeChangeType>

Configures how the ChangeStreamEvent::full_document_before_change field will be populated. By default, the field will be empty for updates.

resume_after: Option<ResumeToken>

Specifies the logical starting point for the new change stream. Note that if a watched collection is dropped and recreated or newly renamed, start_after should be set instead. resume_after and start_after cannot be set simultaneously.

For more information on resuming a change stream see the documentation here

start_at_operation_time: Option<Timestamp>

The change stream will only provide changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here.

start_after: Option<ResumeToken>

Takes a resume token and starts a new change stream returning the first notification after the token. This will allow users to watch collections that have been dropped and recreated or newly renamed collections without missing any notifications.

This feature is only available on MongoDB 4.2+.

See the documentation here for more information.

max_await_time: Option<Duration>

The maximum amount of time for the server to wait on new documents to satisfy a change stream query.

batch_size: Option<u32>

The number of documents to return per batch.

collation: Option<Collation>

Specifies a collation.

read_concern: Option<ReadConcern>

The read concern to use for the operation.

If none is specified, the read concern defined on the object executing this operation will be used.

selection_criteria: Option<SelectionCriteria>

The criteria used to select a server for this operation.

If none is specified, the selection criteria defined on the object executing this operation will be used.

Implementations

Create a builder for building ChangeStreamOptions. On the builder, call .full_document(...)(optional), .full_document_before_change(...)(optional), .resume_after(...)(optional), .start_at_operation_time(...)(optional), .start_after(...)(optional), .max_await_time(...)(optional), .batch_size(...)(optional), .collation(...)(optional), .read_concern(...)(optional), .selection_criteria(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of ChangeStreamOptions.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.