Value
An intermediary value in an aggregation expression.
Each implementation of this interface is a logical BSON node in our own intermediate representation. Each node knows how to writeTo itself into a BSON document.
Instances of this interface are obtained by the end-user through the AggregationOperators builder. Functions from KtMongo which expect aggregation values provide an instance of AggregationOperators into scope automatically. For example, see FilterQuery.expr.
Difference with Expression
This interface and its hierarchy mimic BsonNode. The main difference is the expected context: BsonNode represents an operator, which is stored as a BSON document and doesn't participate in any type hierarchy. Instead, Value is stored as a BSON value and its return type can be further embedded into more values.
Security
Implementing this interface allows injecting arbitrary BSON into a request. Be very careful not to make injections possible.
Implementation notes
Prefer implementing AbstractValue instead of implementing this interface directly.
Debugging notes
Use toString to view the JSON representation of this expression.
See also
Builder for aggregation values.