Skip to content

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

@DavidKrpt

Description

@DavidKrpt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions