Click or drag to resize

BsonExpression Class

Compile and execute string expressions using BsonDocuments. Used in all document manipulation (transform, filter, indexes, updates). See https://github.com/mbdavid/LiteDB/wiki/Expressions
Inheritance Hierarchy
SystemObject
  Internal.LiteDBBsonExpression

Namespace: Internal.LiteDB
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntax
C#
public sealed class BsonExpression

The BsonExpression type exposes the following members.

Properties
 NameDescription
Public propertyFields Fill this hashset with all fields used in root level of document (be used to partial deserialize) - "$" means all fields
Public propertyStatic memberFunctions Get all registered functions for BsonExpressions
Public propertyIsImmutable If true, this expression do not change if same document/paramter are passed (only few methods change - like NOW() - or parameters)
Public propertyIsScalar Indicate if this expressions returns a single value or IEnumerable value
Public propertyStatic memberMethods Get all registered methods for BsonExpressions
Public propertyParameters Get/Set parameter values that will be used on expression execution
Public propertySource Get formatted expression
Public propertyType Indicate expression type
Top
Methods
 NameDescription
Public methodStatic memberCreate(String) Parse string and create new instance of BsonExpression - can be cached
Public methodStatic memberCreate(String, BsonDocument) Parse string and create new instance of BsonExpression - can be cached
Public methodStatic memberCreate(String, BsonValue) Parse string and create new instance of BsonExpression - can be cached
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodExecute(Collation) Execute expression with an empty document (used only for resolve math/functions).
Public methodExecute(BsonDocument, Collation) Execute expression and returns IEnumerable values
Public methodExecute(IEnumerableBsonDocument, Collation) Execute expression and returns IEnumerable values
Public methodExecuteScalar(Collation) Execute scalar expression with an blank document and empty source (used only for resolve math/functions).
Public methodExecuteScalar(BsonDocument, Collation) Execute scalar expression over single document and return a single value (or BsonNull when empty). Throws exception if expression are not scalar expression
Public methodExecuteScalar(IEnumerableBsonDocument, Collation) Execute scalar expression over multiple documents and return a single value (or BsonNull when empty). Throws exception if expression are not scalar expression
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToString
(Overrides ObjectToString)
Top
Operators
 NameDescription
Public operatorStatic member(BsonExpression to String) Implicit string converter
Public operatorStatic member(String to BsonExpression) Implicit string converter
Top
Fields
 NameDescription
Public fieldStatic memberRoot Get root document $ expression
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
See Also