Node
An element in an abstract tree.
It is not expected that users of this library have to deal with this type directly.
Trees
Trees are expected to be built bottom-up: a node is always built before its parents. Once a node has been accepted by a parent, it is simplified then freezes (becomes forever immutable). The same node may be added to multiple parent nodes.
This scheme ensures that trees are always fully simplified: we are always building a single node at a time, and all its children are guaranteed to already be immutable and simplified themselves.
There are two main categories of nodes:
Nodes that represent some data by themselves.
Nodes that group other nodes into a single larger node.
The former category implements this interface, whereas the latter implements CompoundNode.
Implementations
The two main implementations of this interface are:
BsonNode is mainly used for operators in queries
Value is mainly used for operators and their results in aggregations