Skip to content

dollar sign required to inform that field is from an included model. #11365

Closed

Description

@carlos-moreira

I'm trying to search for a field that comes from a included model:
Example:

model.findOne({
      where: query,
      include: [
          {
            model: appModel,
            foreignKey: 'appId',
            attributes: ['partnerId']
          }
      ]
});

The query value is set to:
id: mallId, '$app.partner_id$': hash

I found out about the dollar sign requirement reading these answers from:
https://stackoverflow.com/a/56858118
https://stackoverflow.com/a/56240135

I wasn't able to find associated documentation about this, is it available or not? If not, I think it should be a good idea to add it, I can do a pull request with these instructions if necessary.

Activity

  1. added
    docs
    on Aug 27, 2019
  2. changed the title [-]dollar sign[/-] [+]dollar sign required to informe that field is from an included model.[/+] on Aug 27, 2019
  3. papb commented on Aug 28, 2019

    @papb
    Member

    I wasn't able to find associated documentation about this, is it available or not?

    I also think this is not documented. @sushantdhiman do you think this is something that should be documented or is it considered an 'implementation detail' that could be changed at any moment without notice?

    If not, I think it should be a good idea to add it, I can do a pull request with these instructions if necessary.

    If @sushantdhiman agrees, then it would be great!

  4. bradennapier commented on Aug 29, 2019

    @bradennapier

    I actually ran into this yesterday and ended up having to comb through stack overflow, old documentation which does mention it, etc.

    It is mentioned in the docs but it isn't very clear or prominent.

    https://sequelize.org/master/manual/models-usage.html#top-level-where-with-eagerly-loaded-models

  5. papb commented on Aug 30, 2019

    @papb
    Member

    @bradennapier Nice find!! This answers my question from above: it deserves to be documented (more explicitly)

  6. added
    status: understood
    and removed on Aug 30, 2019
  7. self-assigned this
    on Aug 30, 2019
  8. added
    status: wip
    and removed
    status: understood
    on Sep 6, 2019
  9. changed the title [-]dollar sign required to informe that field is from an included model.[/-] [+]dollar sign required to inform that field is from an included model.[/+] on Jan 15, 2020
  10. papb commented on Jan 15, 2020

    @papb
    Member

    Closed by #11825

    See the new guide on eager loading.

  11. removed
    status: wip
    on Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions