ILiteRepositoryEnsureIndexT, K(String, ExpressionFuncT, K, Boolean, String) Method |
Create a new permanent index in all documents inside this collections if index not exists already.
Namespace: Internal.LiteDBAssembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntaxbool EnsureIndex<T, K>(
string name,
Expression<Func<T, K>> keySelector,
bool unique = false,
string collectionName = null
)
Parameters
- name String
- Index name - unique name for this collection
- keySelector ExpressionFuncT, K
- LinqExpression to be converted into BsonExpression to be indexed
- unique Boolean (Optional)
- Create a unique keys index?
- collectionName String (Optional)
- Collection Name
Type Parameters
- T
- K
Return Value
Boolean
See Also