-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Sequelize.where and is null #4334
Copy link
Copy link
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
"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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type