-
Notifications
You must be signed in to change notification settings - Fork 19
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
Update and patch manipulate data object #29
Comments
@kruschid, did you try removing those lines to see the errors that you get as a result? You can't submit _id as part of the update or patch. It needs to be separated out into a different argument. By the time you get your document back, it should have an |
@marshallswain, I understand your concerns. Yes you are right there is an
According to NeDB documentation you can explicitly set an
I just tried to comment out those three lines in the update method and it didn't cause any errors. What I didn't try is to find out what will happen if I call update with a modified |
@kruschid yup totally fair. We should be using @marshallswain I think it's just that we don't pass in objects with existing ids. We structured our tests differently (not the way I think we should have) and so the tests never encounter this issue. It's probably an issue across a few of the adapters. |
Closed via #30 |
Currently I'm using this library in one of my projects. I created a service to use the
update
andpatch
methods in order to manipulate a few documents and ran in some trouble with that. After passing my data object to these methods I encountered that the_id
attribute was deleted in each data object. I looked for the lines caused the problem and found the following lines:https://github.com/feathersjs/feathers-nedb/blob/master/src/index.js#L114
https://github.com/feathersjs/feathers-nedb/blob/master/src/index.js#L115
https://github.com/feathersjs/feathers-nedb/blob/master/src/index.js#L131
I was able to find a workaround but this implementation breaks with a principles of maintainable code. (Don't modify objects you don't own)
I didn't expect such an effect. What do you think?
The text was updated successfully, but these errors were encountered: