-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
document.remove() removes whole collection #3326
Comments
Whoa yeah that's not terribly good. On it. |
duplicate of #3325 |
This fix should be out now. This is pretty huge |
Done. Thanks. |
@vkarpov15 |
This got me this morning. Thank goodness for database backups. All our platform's apps were deleted. I even started to suspect we had been hacked. |
Sorry about that @shauntrennery - unfortunately we did not have test coverage for this situation and the fix for #3235 went awry. 4.1.4 has been unpublished so hopefully that'll limit the possibility of anybody running into this again... @Martii not that I know of unfortunately. Typically it's a better choice to not explicitly delete individual docs and instead hide them behind an |
I think this commit (caf7181) for a fix of model.remove() has triggered that now when we call:
everything in the collection is removed, previously only the one document was removed.
This can be pretty bad (my users collection was emtpy after deleting one user)... I hope my analysis is not correct.
Also the documentation here states clearly that the current behaviour is not intended: http://mongoosejs.com/docs/api.html#model_Model-remove
model.remove(fn) removes this document from the db.
The text was updated successfully, but these errors were encountered: