Module options

Source
Expand description

Contains all of the types needed to specify options to MongoDB operations.

Most of the options structs in this module use the typed-builder crate to derive a type-safe builder API on them. For example, to create an instance of FindOptions with only limit and batch_size set, the builder API can be used as follows:

use mongodb::options::FindOptions;

let options = FindOptions::builder()
                  .limit(20)
                  .batch_size(5)
                  .build();

Re-exports§

pub use crate::action::csfle::DataKeyOptions;in-use-encryption
pub use crate::action::csfle::EncryptOptions;in-use-encryption

Modules§

oidc
Contains the functionality for OIDC authorization and authentication. Contains the functionality for OIDC authorization and authentication.

Structs§

AggregateOptions
Specifies the options to a Collection::aggregate operation.
BulkWriteOptions
The supported options for bulk_write.
ChangeStreamOptions
These are the valid options that can be passed to the watch method for creating a ChangeStream.
ChangeStreamPreAndPostImages
Specifies how change stream pre- and post-images should be supported.
ClientOptions
Contains the options that can be used to create a new Client.
ClusteredIndex
Specifies options for a clustered collection. Some fields have required values; the Default impl uses those values.
Collation
A collation configuration. See the official MongoDB documentation for more information on each of the fields.
CollectionOptions
These are the valid options for creating a Collection with Database::collection_with_options.
ConnectionString
Contains the options that can be set via a MongoDB connection string.
CountOptions
Specifies the options to a Collection::count_documents operation.
CreateCollectionOptions
These are the valid options for creating a collection with Database::create_collection.
CreateIndexOptions
Specifies the options to a Collection::create_index or Collection:: create_indexes operation.
CreateSearchIndexOptions
Options for Collection::create_search_index. Present to allow additional options to be added in the future as a non-breaking change.
Credential
A struct containing authentication information.
DatabaseOptions
These are the valid options for creating a Database with Client::database_with_options.
DeleteManyModel
Deletes multiple documents.
DeleteOneModel
Deletes a single document.
DeleteOptions
Specifies the options to a Collection::delete_one or Collection::delete_many operation.
DistinctOptions
Specifies the options to a Collection::distinct operation.
DriverInfo
Extra information to append to the driver version in the metadata of the handshake with the server. This should be used by libraries wrapping the driver, e.g. ODMs.
DropCollectionOptions
Specifies the options to a Collection::drop operation.
DropDatabaseOptions
Specifies the options to a Database::drop operation.
DropIndexOptions
Specifies the options to a Collection::drop_index or Collection::drop_indexes operation.
DropSearchIndexOptions
Options for Collection::drop_search_index. Present to allow additional options to be added in the future as a non-breaking change.
EstimatedDocumentCountOptions
Specifies the options to a Collection::estimated_document_count operation.
FindOneAndDeleteOptions
Specifies the options to a Collection::find_one_and_delete operation.
FindOneAndReplaceOptions
Specifies the options to a Collection::find_one_and_replace operation.
FindOneAndUpdateOptions
Specifies the options to a Collection::find_one_and_update operation.
FindOneOptions
Specifies the options to a Collection::find_one operation.
FindOptions
Specifies the options to a Collection::find operation.
GridFsBucketOptions
Contains the options for creating a GridFsBucket.
GridFsDownloadByNameOptions
Contains the options for downloading a file from a GridFsBucket by name.
GridFsFindOneOptions
Contains the options for finding a single FilesCollectionDocument in a GridFsBucket.
GridFsFindOptions
Contains the options for finding FilesCollectionDocuments in a GridFsBucket.
GridFsUploadOptions
Contains the options for uploading a file to a GridFsBucket.
HedgedReadOptions
Specifies hedging behavior for reads.
IndexOptionDefaults
Specifies default configuration for indexes created on a collection, including the _id index.
IndexOptions
These are the valid options for specifying an IndexModel. For more information on these properties, see the documentation.
InsertManyOptions
Specifies the options to a Collection::insert_many operation.
InsertOneModel
Inserts a single document.
InsertOneOptions
Specifies the options to a Collection::insert_one operation.
ListCollectionsOptions
Specifies the options to a Database::list_collections operation.
ListDatabasesOptions
Specifies the options to a Client::list_databases operation.
ListIndexesOptions
Specifies the options to a Collection::list_indexes operation.
ListSearchIndexOptions
Options for Collection::list_search_indexes. Present to allow additional options to be added in the future as a non-breaking change.
ReadConcern
Specifies the consistency and isolation properties of read operations from replica sets and replica set shards.
ReadPreferenceOptions
Specifies read preference options for non-primary read preferences.
ReplaceOneModel
Replaces a single document.
ReplaceOptions
Specifies the options to a Collection::replace_one operation.
ResolverConfigdns-resolver
Configuration for the upstream nameservers to use for resolution.
RunCommandOptions
Specifies the options to a Database::run_command operation.
RunCursorCommandOptions
Specifies the options to a Database::run_cursor_command operation.
ServerApi
Options used to declare a stable server API. For more information, see the Stable API manual page.
SessionOptions
Contains the options that can be used to create a new ClientSession.
TimeseriesOptions
Specifies options for creating a timeseries collection.
TlsOptions
Specifies the TLS configuration that the Client should use.
TransactionOptions
Contains the options that can be used for a transaction.
UpdateManyModel
Updates multiple documents.
UpdateOneModel
Updates a single document.
UpdateOptions
Specifies the options to a Collection::update_one or Collection::update_many operation.
UpdateSearchIndexOptions
Options for Collection::update_search_index. Present to allow additional options to be added in the future as a non-breaking change.
WriteConcern
Specifies the level of acknowledgement requested from the server for write operations.

Enums§

Acknowledgment
The type of the w field in a WriteConcern.
AuthMechanism
The authentication mechanisms supported by MongoDB.
CollationAlternate
Setting that determines whether collation should consider whitespace and punctuation as base characters for purposes of comparison.
CollationCaseFirst
Setting that determines sort order of case differences during case tertiary level comparisons. For more info, see http://userguide.icu-project.org/collation/customization.
CollationMaxVariable
Field that determines up to which characters are considered ignorable when alternate: “shifted”.
CollationStrength
The level of comparison to perform. Corresponds to ICU Comparison Levels.
CommitQuorum
The minimum number of data-bearing voting replica set members (i.e. commit quorum), including the primary, that must report a successful index build before the primary marks the indexes as ready.
Compressorzstd-compression or zlib-compression or snappy-compression
The compressors that may be used to compress messages sent to and decompress messages returned from the server. Note that each variant requires enabling a corresponding feature flag.
CursorType
Specifies the type of cursor to return from a find operation.
FullDocumentBeforeChangeType
Describes the modes for configuring the ChangeStreamEvent::full_document_before_change field.
FullDocumentType
Describes the modes for configuring the ChangeStreamEvent::full_document field.
Hint
Specifies the index to use for an operation.
HostInfo
Specification for mongodb server connections.
IndexVersion
The version of the index. Version 0 Indexes are disallowed as of MongoDB 3.2.
ReadConcernLevel
Specifies the level consistency and isolation properties of a given ReadCocnern.
ReadPreference
Specifies how the driver should route a read operation to members of a replica set.
ReturnDocument
Specifies whether a Collection::find_one_and_replace and Collection::find_one_and_update operation should return the document before or after modification.
SelectionCriteria
Describes which servers are suitable for a given operation.
ServerAddress
An enum representing the address of a MongoDB server.
ServerApiVersion
Specifies the server API version to declare
ServerMonitoringMode
Which server monitoring protocol to use.
Sphere2DIndexVersion
Specify the version for a 2dsphere index. For more information, see Versions.
TextIndexVersion
Specify the version for a text index. For more information, see Versions.
TimeseriesGranularity
The units you’d use to describe the expected interval between subsequent measurements for a time-series.
Tls
Specifies whether TLS configuration should be used with the operations that the Client performs.
UpdateModifications
Enum modeling the modifications to apply during an update. For details, see the official MongoDB documentation
ValidationAction
Specifies whether the database should return an error or simply raise a warning if inserted documents do not pass the validation.
ValidationLevel
Specifies how strictly the database should apply validation rules to existing documents during an update.
WriteModel
A single write to be performed within a bulk_write operation.

Type Aliases§

Predicate
A predicate used to filter servers that are considered suitable.
TagSet
A read preference tag set. See the documentation here for more details.