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

Relational fields are ignored if they are nested 2 levels or deeper in the 'where' parameter #9

Open
DavidKrpt opened this issue Mar 4, 2020 · 0 comments

Comments

@DavidKrpt
Copy link
Contributor

Pretty much the title.
Here's the function that looks for relational fields:

  Model.whichFieldsAreRelational = function (where) {
    return _.keys(where).filter((key) => {
      const headKey = key.split('.')[0];
      return Model.relations[headKey];
    });
  };

if my relational fields are nested like this:

    {
      where: {
        or: [
          {
            'relation.field': someOperator
          }
        ]
      }
    }

they will be ignored. In simple cases you can flatten the 'where' and bring relation fields to the upper level, but it isn't always possible.

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

1 participant