Implemented the $all operator to check if an array value contains all elements from a constraint array.
Use Case
Select records where an array field contains all specified values. For example, finding patients who have all of diabetes (3), obesity (5), and apnea (7):
Query.query(patients, {
conditions: {$all: [3, 5, 7]}
})
Behavior
{x: [1,3,5,7]} with {x: {$all: [5,7]}} → TRUE (has both)
{x: [1,3,5]} with {x: {$all: [5,7]}} → FALSE (missing 7)
{x: []} with {x: {$all: []}} → TRUE (vacuous truth)
- Scalar values treated as single-element arrays
- Uses loose equality matching (e.g., "3" == 3)
Implementation
Follows MongoDB's $all operator semantics and the existing lhs:rhs pattern used throughout the library.
Implemented in commit 2c3936b
Implemented the
$alloperator to check if an array value contains all elements from a constraint array.Use Case
Select records where an array field contains all specified values. For example, finding patients who have all of diabetes (3), obesity (5), and apnea (7):
Behavior
{x: [1,3,5,7]}with{x: {$all: [5,7]}}→ TRUE (has both){x: [1,3,5]}with{x: {$all: [5,7]}}→ FALSE (missing 7){x: []}with{x: {$all: []}}→ TRUE (vacuous truth)Implementation
Follows MongoDB's
$alloperator semantics and the existing lhs:rhs pattern used throughout the library.Implemented in commit 2c3936b