canjs v5.31.0 Release Notes
Release Date: 2019-08-14 // over 4 years ago-
๐ canjs/canjs v5.31.0 Release Notes
๐ This release highlights an updated can-query-logic with support for new
$all
,$and
, and$not
comparisons.๐ can-define
- ๐ can-define v2.7.21
๐ can-define v2.8.0 - Add support for value and oldValue in events
Dispatched events now have avalue
that represents the new value, and anoldValue
for the old value.defineMap.listenTo("prop", (ev) => { console.log("New value", ev.value, "Old value", ev.oldValue); });
๐ can-query-logic
- ๐ can-query-logic v1.2.0 - $all, $not, and $and
๐ This adds support for 3 new comparison operators taken from Mongo's operators.
$all
The
$all
comparison matches collections which contain all of the provided values. For example given the dataset:[{ "id": "Canada", "colors": [ "red", "white"] }, { "id": "Mexico", "colors": ["red", "white", "green"] }, { "id": "USA", "colors": ["red", "white", "blue"] } ]
The query
{ colors: { $all: ["red", "white"] } }
would match all 3 entries. The query{ colors: { $all: ["blue"] } }
would match only USA.$not
The
$not
comparison can be used to negate any other comparison. For example given the dataset:[{ "name": "Joe", "age": 45 }, { "name": "Zoey", "age": 22 }]
The query
{ age: { $not: { $lt: 40 } } }
matches Joe. It is exactly equivalent to{ age: { $gte: 40 } }
.$and
The
$and
comparison combines multiple other comparisons into a single grouping. It can be used in combination with the two above comparisons like so. Given the dataset:[{ "id": "Canada", "colors": [ "red", "white"] }, { "id": "Mexico", "colors": ["red", "white", "green"] }, { "id": "USA", "colors": ["red", "white", "blue"] } ]
The query
{ $and: [{ colors: { $all: ["red, "white"] } }, { colors: { $not: { $all: ["blue"] } } } ] }
matches Canada and Mexico.- ๐ can-query-logic v1.2.1 - Document $all, $and, and $not
๐ This adds docs for the new comparison operators.