WatermelonDB v0.18 Release Notes
Release Date: 2020-06-30 // almost 4 years ago-
๐ Another WatermelonDB release after just a week? Yup! And it's jam-packed full of features!
๐ New features
[Query]
Q.on
queries are now far more flexible. Previously, they could only be placed at the top level of a query. See Docs for more details. Now, you can:Pass multiple conditions on the related query, like so:
collection.query( Q.on('projects', [ Q.where('foo', 'bar'), Q.where('bar', 'baz'), ]) )
You can place
Q.on
deeper inside the query (nested insideQ.and()
,Q.or()
). However, you must explicitly list all tables you're joining on at the beginning of a query, using:Q.experimentalJoinTables(['join_table1', 'join_table2'])
.You can nest
Q.on
conditions insideQ.on
, e.g. to make a condition on a grandchild. To do so, it's required to passQ.experimentalNestedJoin('parent_table', 'grandparent_table')
at the beginning of a query
[Query]
Q.unsafeSqlExpr()
andQ.unsafeLokiExpr()
are introduced to allow adding bits of queries that are not supported by the WatermelonDB query language without having to useunsafeFetchRecordsWithSQL()
. See docs for more details[Query]
Q.unsafeLokiFilter((rawRecord, loki) => boolean)
can now be used as an escape hatch to make queries with LokiJSAdapter that are not otherwise possible (e.g. multi-table column comparisons). See docs for more details
๐ Changes
- ๐ [Performance] [LokiJS] Improved performance of queries containing query comparisons on LokiJSAdapter
- ๐ [Docs] Added Contributing guide for Query language improvements
- ๐ [Deprecation]
Query.hasJoins
is deprecated - [DX] Queries with bad associations now show more helpful error message
- [Query] Counting queries that contain
Q.experimentalTake
/Q.experimentalSkip
is currently broken - previously it would return incorrect results, but now it will throw an error to avoid confusion. Please contribute to fix the root cause!
๐ Fixes
- ๐ [Typescript] Fixed types of Relation
Internal
QueryDescription
structure has been changed.