You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to use the /meta resource to add non-mds-standard-information to entities, majorly geographies and policies.
E. g. we want to "tag" policies with a type, meaning the policy regulates a fleet.
However, we cannot query for this information easily, but we need to retrieve the full data set and filter afterwards.
Proposal
Add a query parameter to the APIs for reading entities (mds-policy, mds-geography-api) which joins and filters based on metadata. Since meta holds a JSON, this will have to translate to a fancy query on the particular services.
Imho, it's fine to query only for equality (no pattern-patching or other operators).
/policies?meta.type=fleet should be sufficient. Of course, supporting the additional jsonb operators is an option as well, but I don't know if this is consumer friendly ;)
The text was updated successfully, but these errors were encountered:
Thanks for raising this issue! I think that the trickiest thing to figure out will be how to convey the JSON query in the URL, as well as what we should query the DB with. I think the solution you mentioned could work, but part of me wants to be able to just supply a JSON blob and do a partial match (similar to the Jest .toMatchObject method the whole way through...
I thought so too, but partial matching an object is not really what queries are about (in general). I'd expect a JSON-object in the query parameter to describe the query, not the target partial object.
When it comes to formulating a query in json, I am actually quite happy with MongoDBs query document syntax. Funny enough, I just found a zero dependencies npm library which converts mongo queries to PostgreSQLs jsonb.
Looks like I am at least not the only fan of that idea ;-)
Motivation
We want to use the
/meta
resource to add non-mds-standard-information to entities, majorly geographies and policies.E. g. we want to "tag" policies with a type, meaning the policy regulates a fleet.
However, we cannot query for this information easily, but we need to retrieve the full data set and filter afterwards.
Proposal
Add a query parameter to the APIs for reading entities (
mds-policy
,mds-geography-api
) which joins and filters based on metadata. Sincemeta
holds a JSON, this will have to translate to a fancy query on the particularservice
s.Imho, it's fine to query only for equality (no pattern-patching or other operators).
/policies?meta.type=fleet
should be sufficient. Of course, supporting the additionaljsonb
operators is an option as well, but I don't know if this is consumer friendly ;)The text was updated successfully, but these errors were encountered: