Struct mongodb::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>,
}
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
.
Trait Implementations
sourceimpl Clone for IndexOptions
impl Clone for IndexOptions
sourcefn clone(&self) -> IndexOptions
fn clone(&self) -> IndexOptions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for IndexOptions
impl Debug for IndexOptions
sourceimpl Default for IndexOptions
impl Default for IndexOptions
sourcefn default() -> IndexOptions
fn default() -> IndexOptions
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for IndexOptions
impl<'de> Deserialize<'de> for IndexOptions
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for IndexOptions
impl Serialize for IndexOptions
Auto Trait Implementations
impl RefUnwindSafe for IndexOptions
impl Send for IndexOptions
impl Sync for IndexOptions
impl Unpin for IndexOptions
impl UnwindSafe for IndexOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more