-
Notifications
You must be signed in to change notification settings - Fork 96
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
Change remove-all syntax. #74
Comments
@marshallswain makes sense. I would actually prefer that we didn't require people to pass Can you post a PR with what you think the fix should be? |
yes eric, personally I agree with you that setting id to null to make multiple change is not an ideal design. I prefer what meteor did in minimingo: when the first parameter is a string or objectid, it makes single modification; when the first parameter is an object, it would be taken as a query object and makes multiple modification. I also agree that since this is related to all adapters, it is not hurry to make decision to change tje design. |
Yes! That API sounds much better. When do we want to target updating the adapters? I think the sooner the better. |
{}
to remove all records.
Since you guys are interested in this, I would like to further suggest separating
This design would be more compatible with the traditional mongo syntax, and at the same time allows users to specify particular params for feathers, and also be more backward-compatible with our current syntax (by allowing put |
The @feathersjs/core-team discussed this internally and for the near future it's not feasible. It would introduce breaking changes across a bunch of repos. Although the current syntax is a bit weird, the amount of effort for the little gain is just not worth it right now. We might revisit in 6-12 months time, at which point we'll open an issue in the main repo. |
https://github.com/feathersjs/feathers-mongoose/blob/master/src/service.js#L191
The user should be required to pass both
null
and{}
likeservice.remove(null, {})
in order to remove all records. Since the default query is already set to{}
, if an id in the app accidentally gets set tonull
and the user triesservice.remove(id)
they just wiped out the entire collection in the database. If you guys agree, I will make the changes.We should check if the id is null and also check if at least a query object was passed in order to remove.
The text was updated successfully, but these errors were encountered: