-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
sequelize.where function not working in model scope #6440
Comments
I faced the same issue and need helps! |
+1 |
@felixfbecker Sorry about +1 @cakenggt @sj82516 I wrapped sequelize.where with $and and the error disappeared.
|
I have also run into this bug, I can confirm that:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂 |
I am encountering this bug as well..
is producing invalid query |
this is still an issue, it's well documented and numerous people have confirmed it - the only reason there is no activity on this issue is because no maintainer has had/taken the time to do something with it. please re-open this bug. |
I'm experiencing this issue as well. |
Same here ... |
Same |
1 similar comment
Same |
Fixed #9730 |
I am trying to use a sequelize.where function in one of the scopes in one of my models. However, when I then do a query with that scope, the query gets mangled.
What you are doing?
Run
node test.js
to get the result.models.js
test.js
What do you expect to happen?
The query to execute without errors and pull all stores that are less than or equal to 5 meters from the provided latitude and longitude. Since this code sample doesn't place any stores in the db, I just expect this code sample to execute without error.
What is actually happening?
The query executes with the error
SequelizeDatabaseError: column store.attribute does not exist
Output: The query that runs follows:
SELECT "id", "name", "location", "createdAt", "updatedAt", "userId" FROM "stores" AS "store" WHERE "store"."attribute" = ST_Distance("store"."location", ST_GEOGFROMTEXT('POINT(36.09 51.04)')) AND "store"."comparator" = '<=' AND "store"."logic" = 5;
Dialect: postgres
Sequelize version: 3.23.6
The text was updated successfully, but these errors were encountered: