As of v1.0.4, JayData supports embedded queries on WebSQL/SQLite provider. This allows you to form more complex selections, still only using clean JSLQ syntax. As additional advantage, you can avoid the need to handle additional asynchrony in your code, as well as loading data to the client you won’t need directly.
The following example shows you how to use this feature (the code runs in our NewsReaderContext).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$news.context.Users.filter( function(item) { // Filter predicate return item.Id in this.authorIds; }, { // Another query as filter parameter authorIds: $news.context.Articles.map( function(item) { return item.Author.Id; }) } ).toArray(function(result) { console.dir(result); }); |
As result, you’ll get the users who are also authors of at least one article.