Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need query expression to access attributes on related records #370

Closed
dgeb opened this issue Oct 18, 2016 · 2 comments
Closed

Need query expression to access attributes on related records #370

dgeb opened this issue Oct 18, 2016 · 2 comments

Comments

@dgeb
Copy link
Member

dgeb commented Oct 18, 2016

As per the discussion in #369, we'd like to support a new query expression for accessing attributes on related records. This expression should allow for traversing multiple relationships, although sources may choose to limit support for traversal depth.

It's proposed that this expression be called relatedAttribute and take two arguments:

  • an array of relationship names
  • an attribute name

For example:

oqe('relatedAttribute', ['author'], 'name')

oqe('relatedAttribute', ['author', 'company'], 'city')

This expression could be used in sort expressions as a field. For example:

qb.records('post')
  .sort({ field: oqe('relatedAttribute', ['author'], 'name'), order: 'ascending' });

The following compact form, using dot-separated paths, could de-sugar to the above:

qb.records('post')
  .sort('author.name');
@dgeb
Copy link
Member Author

dgeb commented Jul 18, 2017

I am going to close my issue here because the details about query expressions are quite outdated. However, I'm open to considering a proposal for filtering findRecords query ops based on related record attributes.

@dgeb dgeb closed this as completed Jul 18, 2017
@mrosenberg
Copy link

Did anything ever come of this? I'm running into a situation where sorting by related record would really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants