17.57. Class IndexHelper

Namespace: ArmoniK.Core.Adapters.MongoDB.Table.DataModel
Assembly: ArmoniK.Core.Adapters.MongoDB.dll

Helpers to created indexes for MongoDB

public class IndexHelper

17.57.1. Inheritance

objectIndexHelper

17.57.2. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

17.57.3. Methods

17.57.3.1. CreateAscendingIndex<T>(Expression<Func<T, object?>>, bool, TimeSpan?)

Creates an ascending index model from expression

public static CreateIndexModel<T> CreateAscendingIndex<T>(Expression<Func<T, object?>> expr, bool unique = false, TimeSpan? expireAfter = null)

17.57.3.1.1. Parameters

expr Expression<Func<T, object?>>

Expression to select the field for the index

unique bool

Unicity constraint, default to false

expireAfter TimeSpan?

Setup document should expire

17.57.3.1.2. Returns

CreateIndexModel<T>

The ascending index model

17.57.3.1.3. Type Parameters

T

Type stored in database

17.57.3.2. CreateCombinedIndex<T>(Expression<Func<T, object?>>, Expression<Func<T, object?>>)

Creates a combined index model from expression

public static CreateIndexModel<T> CreateCombinedIndex<T>(Expression<Func<T, object?>> first, Expression<Func<T, object?>> second)

17.57.3.2.1. Parameters

first Expression<Func<T, object?>>

Expression to select the field for the first index

second Expression<Func<T, object?>>

Expression to select the field for the second index

17.57.3.2.2. Returns

CreateIndexModel<T>

The combined index model

17.57.3.2.3. Type Parameters

T

Type stored in database

17.57.3.3. CreateDescendingIndex<T>(Expression<Func<T, object?>>, bool)

Creates an descending index model from expression

public static CreateIndexModel<T> CreateDescendingIndex<T>(Expression<Func<T, object?>> expr, bool unique = false)

17.57.3.3.1. Parameters

expr Expression<Func<T, object?>>

Expression to select the field for the index

unique bool

Unicity constraint, default to false

17.57.3.3.2. Returns

CreateIndexModel<T>

The descending index model

17.57.3.3.3. Type Parameters

T

Type stored in database

17.57.3.4. CreateHashedCombinedIndex<T>(Expression<Func<T, object?>>, Expression<Func<T, object?>>)

Creates a combined index model (hashed + ascending) from expression

public static CreateIndexModel<T> CreateHashedCombinedIndex<T>(Expression<Func<T, object?>> hashed, Expression<Func<T, object?>> ascending)

17.57.3.4.1. Parameters

hashed Expression<Func<T, object?>>

Expression to select the field for the hashed index

ascending Expression<Func<T, object?>>

Expression to select the field for the ascending index

17.57.3.4.2. Returns

CreateIndexModel<T>

The combined index model

17.57.3.4.3. Type Parameters

T

Type stored in database

17.57.3.5. CreateHashedIndex<T>(Expression<Func<T, object?>>)

Creates an hashed index model from expression

public static CreateIndexModel<T> CreateHashedIndex<T>(Expression<Func<T, object?>> expr)

17.57.3.5.1. Parameters

expr Expression<Func<T, object?>>

Expression to select the field for the index

17.57.3.5.2. Returns

CreateIndexModel<T>

The hashed index model

17.57.3.5.3. Type Parameters

T

Type stored in database

17.57.3.6. CreateIndex<T>(params (IndexType type, Expression<Func<T, object?>> expression)[])

Creates a generic index from a list of indices type and expressions, with no unicity constraint

public static CreateIndexModel<T> CreateIndex<T>(params (IndexType type, Expression<Func<T, object?>> expression)[] field)

17.57.3.6.1. Parameters

field (IndexType type, Expression<Func<T, object?>> expression)[]

Type and Expressions to select the fields for the index

17.57.3.6.2. Returns

CreateIndexModel<T>

The corresponding generated index

17.57.3.6.3. Type Parameters

T

Type stored in database

17.57.3.6.4. Exceptions

ArgumentException

Thrown when fields has no expression

ArgumentOutOfRangeException

Thrown for invalid IndexType, or hashed index related issues

17.57.3.7. CreateIndex<T>(IndexType, Expression<Func<T, object?>>)

Creates an index from an index type and expression, with no unicity constraint

public static CreateIndexModel<T> CreateIndex<T>(IndexType type, Expression<Func<T, object?>> expression)

17.57.3.7.1. Parameters

type IndexType

Type of index

expression Expression<Func<T, object?>>

Expression to select the field for the index

17.57.3.7.2. Returns

CreateIndexModel<T>

The corresponding generated index

17.57.3.7.3. Type Parameters

T

Type stored in database

17.57.3.7.4. Exceptions

ArgumentOutOfRangeException

Thrown for invalid IndexType, or hashed index related issues

17.57.3.8. CreateIndex<T>(bool, params (IndexType type, Expression<Func<T, object?>> expression)[])

Creates a generic index from a list of indices type and expressions

public static CreateIndexModel<T> CreateIndex<T>(bool unique, params (IndexType type, Expression<Func<T, object?>> expression)[] field)

17.57.3.8.1. Parameters

unique bool

Unicity constraint

field (IndexType type, Expression<Func<T, object?>> expression)[]

Expressions to select the fields for the index

17.57.3.8.2. Returns

CreateIndexModel<T>

The corresponding generated index

17.57.3.8.3. Type Parameters

T

Type stored in database

17.57.3.8.4. Exceptions

ArgumentException

Thrown when fields has no expression

ArgumentOutOfRangeException

Thrown for invalid IndexType, or hashed index related issues

17.57.3.9. CreateTextIndex<T>(Expression<Func<T, object?>>, bool)

Creates an text index model from expression

public static CreateIndexModel<T> CreateTextIndex<T>(Expression<Func<T, object?>> expr, bool unique = false)

17.57.3.9.1. Parameters

expr Expression<Func<T, object?>>

Expression to select the field for the index

unique bool

Unicity constraint, default to false

17.57.3.9.2. Returns

CreateIndexModel<T>

The text index model

17.57.3.9.3. Type Parameters

T

Type stored in database

17.57.3.10. CreateUniqueIndex<T>(params (IndexType type, Expression<Func<T, object?>> expression)[])

Creates a generic index from a list of indices type and expressions with a unicity constraint

public static CreateIndexModel<T> CreateUniqueIndex<T>(params (IndexType type, Expression<Func<T, object?>> expression)[] field)

17.57.3.10.1. Parameters

field (IndexType type, Expression<Func<T, object?>> expression)[]

Expressions to select the fields for the index

17.57.3.10.2. Returns

CreateIndexModel<T>

The corresponding generated index

17.57.3.10.3. Type Parameters

T

Type stored in database

17.57.3.10.4. Exceptions

ArgumentException

Thrown when fields has no expression

ArgumentOutOfRangeException

Thrown for invalid IndexType, or hashed index related issues

17.57.3.11. CreateUniqueIndex<T>(IndexType, Expression<Func<T, object?>>)

Creates an index from an index type and expression with a unicity constraint

public static CreateIndexModel<T> CreateUniqueIndex<T>(IndexType type, Expression<Func<T, object?>> expression)

17.57.3.11.1. Parameters

type IndexType

Type of index

expression Expression<Func<T, object?>>

Expression to select the field for the index

17.57.3.11.2. Returns

CreateIndexModel<T>

The corresponding generated index

17.57.3.11.3. Type Parameters

T

Type stored in database

17.57.3.11.4. Exceptions

ArgumentOutOfRangeException

Thrown for invalid IndexType, or hashed index related issues