-
Notifications
You must be signed in to change notification settings - Fork 604
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
Return empty/zero from IN w/empty array #1076
Conversation
Just to make sure I understand, how would the specific call |
@devinivy Collection.destroy({id: []}) should return a callback with no error but also an empty "deleted" array. Right now, it behaves exactly like Collection.destroy({}). |
@dmarcelino Added a unit test! |
Cool! 😀 |
@slester what would |
@devinivy |
Cool– sounds good :) |
Let me know if anything is lacking for this PR! |
+1 |
Return empty/zero from IN w/empty array
Thanks @slester! |
Calling Collection.destroy({id: []}) destroys all documents. Functionality exists in normalize that returns false if there's an empty array, but false is OR'd with {}, resulting in a {} being passed to the sails-mongo adapter, which deletes everything.
This PR just applies what is already implemented for find().
We found this out the hard way. :(