Skip to content

Sequelize.where and is null #4334

@User4martin

Description

@User4martin

"c" in the examples is S.fn('lower', S.col('name'))

S.where(c, null);

fails with
Error: TypeError: Cannot read property '_isSequelizeMethod' of null,
Of course the doc says, that in the 2 argument version the comparator is '='

So using 3 arguments (comparator as string, as specified by docs
http://sequelize.readthedocs.org/en/latest/api/sequelize/index.html?highlight=col#whereattr-comparator-logic-sequelizewhere

S.where(c, 'is', null);

and get the same error.

I did find a workaround, using S.literal. But I wonder if that is the way to go (other than as workaround)

S.where(c, 'is', S.literal('null'));

This also has a curiosity of its own. There is no spacing around the comparator. So the sql is

  c isnull

which means

S.where(c, 'is not', S.literal('null'));

fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions