Click or drag to resize

ILiteRepositoryEnsureIndexT(BsonExpression, Boolean, String) Method

Create a new permanent index in all documents inside this collections if index not exists already. Returns true if index was created or false if already exits

Namespace: Internal.LiteDB
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
bool EnsureIndex<T>(
	BsonExpression expression,
	bool unique = false,
	string collectionName = null
)

Parameters

expression  BsonExpression
Create a custom expression function to be indexed
unique  Boolean  (Optional)
If is a unique index
collectionName  String  (Optional)
Collection Name

Type Parameters

T

Return Value

Boolean
See Also