Struct mungos::options::IndexOptions
source · [−]#[non_exhaustive]pub struct IndexOptions {Show 20 fields
pub background: Option<bool>,
pub expire_after: Option<Duration>,
pub name: Option<String>,
pub sparse: Option<bool>,
pub storage_engine: Option<Document>,
pub unique: Option<bool>,
pub version: Option<IndexVersion>,
pub default_language: Option<String>,
pub language_override: Option<String>,
pub text_index_version: Option<TextIndexVersion>,
pub weights: Option<Document>,
pub sphere_2d_index_version: Option<Sphere2DIndexVersion>,
pub bits: Option<u32>,
pub max: Option<f64>,
pub min: Option<f64>,
pub bucket_size: Option<u32>,
pub partial_filter_expression: Option<Document>,
pub collation: Option<Collation>,
pub wildcard_projection: Option<Document>,
pub hidden: Option<bool>,
/* private fields */
}
Expand description
These are the valid options for specifying an IndexModel
.
For more information on these properties, see the documentation.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.background: Option<bool>
Tells the server to build the index in the background and not block other tasks. Starting in MongoDB 4.2, this option is deprecated and ignored by the server.
expire_after: Option<Duration>
Specifies a TTL to control how long MongoDB retains documents in this collection.
See the documentation for more information on how to use this option.
name: Option<String>
Specifies a name outside the default generated name.
sparse: Option<bool>
If true, the index only references documents with the specified field. The default value is false.
See the documentation for more information on how to use this option.
storage_engine: Option<Document>
Allows users to configure the storage engine on a per-index basis when creating an index.
unique: Option<bool>
Forces the index to be unique so the collection will not accept documents where the index key value matches an existing value in the index. The default value is false.
version: Option<IndexVersion>
Specify the version number of the index. Starting in MongoDB 3.2, Version 0 indexes are not allowed.
default_language: Option<String>
For text indexes, the language that determines the list of stop words and the rules for the stemmer and tokenizer.
language_override: Option<String>
For text
indexes, the name of the field, in the collection’s documents, that
contains the override language for the document.
text_index_version: Option<TextIndexVersion>
The text
index version number. Users can use this option to override the default
version number.
weights: Option<Document>
For text
indexes, a document that contains field and weight pairs.
sphere_2d_index_version: Option<Sphere2DIndexVersion>
The 2dsphere
index version number.
As of MongoDB 3.2, version 3 is the default. Version 2 is the default in MongoDB 2.6 and
3.0 series.
bits: Option<u32>
For 2dsphere
indexes, the number of precision of the stored geohash value of the
location data. The bits value ranges from 1 to 32 inclusive.
max: Option<f64>
For 2dsphere
indexes, the upper inclusive boundary for the longitude and latitude
values.
min: Option<f64>
For 2dsphere
indexes, the lower inclusive boundary for the longitude and latitude
values.
bucket_size: Option<u32>
For geoHaystack
indexes, specify the number of units within which to group the location
values.
partial_filter_expression: Option<Document>
If specified, the index only references documents that match the filter expression. See Partial Indexes for more information.
collation: Option<Collation>
Specifies the collation for the index.
wildcard_projection: Option<Document>
Allows users to include or exclude specific field paths from a wildcard index.
A flag that determines whether the index is hidden from the query planner. A hidden index is not evaluated as part of the query plan selection.
Implementations
sourceimpl IndexOptions
impl IndexOptions
sourcepub fn builder(
) -> IndexOptionsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder(
) -> IndexOptionsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building IndexOptions
.
On the builder, call .background(...)
(optional), .expire_after(...)
(optional), .name(...)
(optional), .sparse(...)
(optional), .storage_engine(...)
(optional), .unique(...)
(optional), .version(...)
(optional), .default_language(...)
(optional), .language_override(...)
(optional), .text_index_version(...)
(optional), .weights(...)
(optional), .sphere_2d_index_version(...)
(optional), .bits(...)
(optional), .max(...)
(optional), .min(...)
(optional), .bucket_size(...)
(optional), .partial_filter_expression(...)
(optional), .collation(...)
(optional), .wildcard_projection(...)
(optional), .hidden(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of IndexOptions
.
sourceimpl IndexOptions
impl IndexOptions
sourcepub fn clustered(&self) -> Option<bool>
pub fn clustered(&self) -> Option<bool>
Optionally specifies that this index is clustered. This is not a valid option to provide to ‘create_indexes’, but can appear in the options returned for an index via ‘list_indexes’. To create a clustered index, create a new collection using the ‘clustered_index’ option.
This options is only supported by servers >= 6.0.
Trait Implementations
sourceimpl Clone for IndexOptions
impl Clone for IndexOptions
sourcefn clone(&self) -> IndexOptions
fn clone(&self) -> IndexOptions
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more