Click or drag to resize

LiteCollectionTEnsureIndexK(String, ExpressionFuncT, K, Boolean) Method

Create a new permanent index in all documents inside this collections if index not exists already.

Namespace: Internal.LiteDB
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
public bool 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

Implements

ILiteCollectionTEnsureIndexK(String, ExpressionFuncT, K, Boolean)
See Also