Skip to content
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

destroyAll does not respect normalizeUndefinedInQuery #2364

Closed
tmikulcek opened this issue May 23, 2016 · 5 comments
Closed

destroyAll does not respect normalizeUndefinedInQuery #2364

tmikulcek opened this issue May 23, 2016 · 5 comments
Assignees

Comments

@tmikulcek
Copy link

This bit us today. An undefined value got into the where clause of destroyAll and caused a delete of all items. We tried using normalizeUndefinedInQuery option as per #637 but it only works in find queries.

Sample repo: https://github.com/tmikulcek/loopback-sandbox
Run the test with mocha

@0candy 0candy assigned loay and unassigned 0candy Jun 15, 2016
@loay
Copy link
Contributor

loay commented Jun 15, 2016

Hi @tmikulcek
I am having a look. I will get back to you ASAP.

@loay loay added the triaging label Jun 15, 2016
@loay loay added bug and removed triaging labels Oct 19, 2016
@loay
Copy link
Contributor

loay commented Oct 19, 2016

Hi @tmikulcek
as I can see here in find: Error: Unexpected undefined in query
but the err in destroyall gives undefined and that's why the test fails.
I will flag it as a bug.
Thanks for reporting the issue.

@angfal
Copy link
Contributor

angfal commented Feb 3, 2017

Hi, everyone!

The same problem with count and update methods. As I understand, all filter/where objects should 'removeUndefined' with 'normalizeUndefinedInQuery' parameter. And all data objects (for create, update) without it.

Could you please pay attention on this bug? Because it's an enough serious problem. The requests like Model.remove({id: $id, cb}); and Model.update({id: $id, $data, cb}); can totally corrupt data in the database if $id somehow equals 'undefined'

@raymondfeng
Copy link
Member

raymondfeng commented Jul 3, 2017

@kjdelisle kjdelisle added team-apex and removed apex labels Jul 5, 2017
loay pushed a commit to loopbackio/loopback-datasource-juggler that referenced this issue Aug 3, 2017
@loay
Copy link
Contributor

loay commented Aug 9, 2017

Issue is fixed. Please have a look.
If issue is still persisting, please leave a comment here. Thanks.

@loay loay added this to the Sprint 42 - Apex milestone Aug 11, 2017
@loay loay closed this as completed Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants