vibe.db.mongo.impl.index

MongoDB index API definitions.

Types 8

deprecated Use CreateIndexOptions instead
none = 0
unique = 1 << 0
dropDuplicates = 1 << 2
background = 1 << 3
sparse = 1 << 4
expireAfterSeconds = 1 << 5
None = noneDeprecated compatibility alias, use `none` instead.
Unique = uniqueDeprecated compatibility alias, use `unique` instead.
DropDuplicates = dropDuplicatesDeprecated compatibility alias, use `dropDuplicates` instead.
Background = backgroundDeprecated compatibility alias, use `background` instead.
Sparse = sparseDeprecated compatibility alias, use `sparse` instead.
ExpireAfterSeconds = expireAfterSecondsDeprecated compatibility alias, use `expireAfterSeconds` instead.
Fields
Bson keys
IndexOptions options
Methods
IndexModel add(string field, int direction) ref return @safeAdds a single field or multikey index with a direction.
IndexModel add(string field, string type) ref return @safeAdds an index with a given index type. Use `IndexType` for a type-safe setting of the string.
IndexModel withOptions(IndexOptions options) ref return @safeSets the options member of this IndexModel.
string name() const @property @safe
enumIndexType : string

Specifies the different index types which are available for index creation.

See Also

legacy2D = "2d"Legacy 2D plane index used in MongoDB 2.2 and earlier. Doesn't support GeoJSON objects. Uses planar geometry to return results.
sphere2D = "2dsphere"2D sphere index that calculates geometries on an earth-like sphere. Supports storing as GeoJSON objects.
geoHaystack = "geoHaystack"A geoHaystack index is a special index that is optimized to return results over small areas. geoHaystack indexes improve performance on queries that use flat geometry.
text = "text"Creates a text index which supports searching for string content in a collection. These text indexes do not store language-specific stop words and stem the words in a collection to only store root ...
hashed = "hashed"To support hash based sharding, MongoDB provides a hashed index type, which indexes the hash of the value of a field. These indexes have a more random distribution of values along their range, but ...
Fields
Nullable!bool backgroundSpecifying true directs MongoDB to build the index in the background. Background builds do not block operations on the collection. Since MongoDB 4.2 indices are built on the background by default. ...
Nullable!int expireAfterSecondsSpecifies the length in time, in seconds, for documents to remain in a collection.
string nameOptionally specify a specific name for the index outside of the default generated name. If none is provided then the name is generated in the format "[field]_[direction]"
Nullable!bool sparseTells the index to only reference documents with the specified field in the index.
Nullable!Bson storageEngineAllows configuring the storage engine on a per-index basis.
Nullable!bool uniqueForces the index to be unique.
Nullable!bool dropDupsCreates a unique index on a field that may have duplicates.
Nullable!int version_Specifies the index version number, either 0 or 1.
Nullable!string defaultLanguageDefault language for text indexes. Is "english" if none is provided.
Nullable!string languageOverrideSpecifies the field in the document to override the language.
Nullable!int textIndexVersionSets the text index version number.
Nullable!Bson weightsSpecifies fields in the index and their corresponding weight values.
Nullable!int _2dsphereIndexVersionSets the 2dsphere index version number.
Nullable!int bitsFor 2d indexes, the number of precision of the stored geo hash value of the location data.
Nullable!double maxFor 2d indexes, the upper inclusive boundary for the longitude and latitude values.
Nullable!double minFor 2d indexes, the lower inclusive boundary for the longitude and latitude values.
Nullable!double bucketSizeFor geoHaystack indexes, specify the number of units within which to group the location values; i.e. group in the same bucket those location values that are within the specified number of units to ...
Nullable!Bson partialFilterExpressionIf specified, the index only references documents that match the filter expression. See https://docs.mongodb.com/manual/core/index-partial/ for more information.
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!Bson wildcardProjectionAllows users to include or exclude specific field paths from a wildcard index using the `{ "$**": 1 }` key pattern.
Methods
void expireAfter(Duration d) @safe
Fields
Nullable!long maxTimeMSThe maximum amount of time to allow the index build to take before returning an error. (not implemented)
Fields
Nullable!long maxTimeMSThe maximum amount of time to allow the index drop to take before returning an error. (not implemented)