ILiteCollectionTEnsureIndexK(String, ExpressionFuncT, K, Boolean) 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<K>(
string name,
Expression<Func<T, K>> keySelector,
bool unique = false
)
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?
Type Parameters
- K
Return Value
Boolean
See Also