asFindQuery() returns wrong builder for patchAndFetchById() operations
See original GitHub issueI am using asFindQuery()
to get the affected items in a static beforeUpdate()
model hook that gets called when patchAndFetchById()
is executed.
In this situation, asFindQuery()
does not return a query that only selects the affected model items, it returns a query without a where clause, returning all model items of the given model class.
According to the docs, it should only return the model item with the given id?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Vincit/objection.js - Gitter
I started transaction with PrescriptionMetaData Model and related PrescriptionSymptom Model by relationMappings as followings. Inside PrescriptionMetaData DAO.
Read more >Mutating Methods | Objection.js
Creates an insert query. The inserted objects are validated against the model's jsonSchema. If validation fails the Promise is rejected with a ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll start working on this now.
I’m facing the same issue with
updateAndFetchById
. In code belowasFindQuery
executing returns all rows from DB:As a temporal solution, for this model with
beforeUpdate
hook I replacedupdateAndFetchById
with