You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I had the following wrong query at a competition game:
Model
.where({uid: uid}) // Wrong syntax
.where('address').exists(false)
.limit(1)
.desc('date') ...
I passed an object to the first where()-clause, but this wrong usage got completly ignored, in a silent error. As a result i got the newest document without an address, but accidently not matching the 'uid'. As next step I wrote the address of the user into a wrong document and could not match the win to the address anymore.
The correct syntax would be:
Model
.where('uid', uid) // Correct syntax
.where('address').exists(false)
.limit(1)
.desc('date') ...
This is tricky, because you can write this in a correct way
.find({uid: uid}),
but not this
.where({uid: uid}).
Maybe Mongoose could catch up such wrong usage by looking if the arguments are well formed and throw an error if neccesary.
The text was updated successfully, but these errors were encountered:
Hi,
I had the following wrong query at a competition game:
Model
.where({uid: uid}) // Wrong syntax
.where('address').exists(false)
.limit(1)
.desc('date') ...
I passed an object to the first where()-clause, but this wrong usage got completly ignored, in a silent error. As a result i got the newest document without an address, but accidently not matching the 'uid'. As next step I wrote the address of the user into a wrong document and could not match the win to the address anymore.
The correct syntax would be:
Model
.where('uid', uid) // Correct syntax
.where('address').exists(false)
.limit(1)
.desc('date') ...
This is tricky, because you can write this in a correct way
.find({uid: uid}),
but not this
.where({uid: uid}).
Maybe Mongoose could catch up such wrong usage by looking if the arguments are well formed and throw an error if neccesary.
Reply to this email directly or view it on GitHub: #969
Hi,
I had the following wrong query at a competition game:
I passed an object to the first where()-clause, but this wrong usage got completly ignored, in a silent error. As a result i got the newest document without an address, but accidently not matching the 'uid'. As next step I wrote the address of the user into a wrong document and could not match the win to the address anymore.
The correct syntax would be:
This is tricky, because you can write this in a correct way
.find({uid: uid}),
but not this
.where({uid: uid}).
Maybe Mongoose could catch up such wrong usage by looking if the arguments are well formed and throw an error if neccesary.
The text was updated successfully, but these errors were encountered: