Change behavior of ManagedSet.haveAtLeastOneWhere
This is getting hung by by stricter type checks, and wasn't the best solution in the first place. The preferred solution would be have variants of this expression behavior, and to also remove its signature from ManagedSet because it is misleading.
Preliminary research has shown that a preferable API might be the following:
query.where((o) => o.children).have(anyOf: (child) => child.field).equalTo(...);
query.where((o) => o.children).have(noneOf: (child) => child.field).equalTo(...);
query.where((o) => o.children).have(allOf: (child) => child.field).equalTo(...);
Issues are that QueryExpression<T, U> expects to retain the type argument U (the object type being queried) throughout the expression chain, but this may be worth looking at if it is even viable.
Hi @joeconwaystk - so as far as I understand
haveAtLeastOneWhere
has been removed and there is no replacement for it at the moment? If that's so then the doc probably should be updated https://aqueduct.io/docs/db/advanced_queries/
@joeconwaystk Hello! I very need an example of usage without haveAtLeastOneWhere
Example:
var query = new Query<Team>(context)
..where((t) => t.players.haveAtLeastOneWhere.yearsPlayed).lessThanOrEqualTo(1);
var teamsWithRookies = await query.fetch();
- https://aqueduct.io/docs/snippets/orm/
@jayjah Yes, but haveAtLeastOneWhere was removed and now I don't see alter solutions