-
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
Patch is deleting subdocument data #144
Comments
Could this be the Mongoose/MongoDB default behaviour? It's just using |
You would have to use $set to only set that particular property in the subdocument |
I think you want something like this. usersService.patch(userId, { $set: { "social.twitter": {username: '@the_username'} } }) |
I agree about using @corymsmith I am not using feathers client. I'm sending a UpdateI just tried sending This seems counterintuitive since a patch request by nature needs to use Update2
"$set": {
"social.twitter.username": "@test"
} |
Also, I'm not sure about the API of other Database plugins, but doesn't using |
When you send a patch of the following you are effectively saying, set only the {
"social": {
"twitter": {
"username": "@the_username"
}
}
} The nature of patch is that it patches top level properties, otherwise how would the API know if you wanted to set a new value for |
I'm not sure if it will work but you could also try a patch with this payload using dot notation: {
"social.twitter": {
"username": "@the_username"
}
} |
@corymsmith that second example does work without |
Perfect, I figured it would but didn't test it out before posting that comment :) |
I think this has been figured out right? I think in general Feathers should leave the deep-merge behaviour up to the ORM since some (like all SQL ORMs) don't even support nested objects at all. |
Ya this is figured out. |
Yes, closed, and yet so helpful. Thank you all. |
This is still a problem with AJV... |
My API uses
feathers-mongoose
for the db and when I send JSON (via postman) topatch
my model I'm losing subdocument (embedded?) data. For example, if I have a model like thisand I send a patch request with
it deletes
social.facebook
Expected behavior
It shouldn't delete the sibling subdocuments. In this example
social.facebook
.System configuration
Module versions (especially the part that's not working):
[email protected]
NodeJS version:
v6.5.0
The text was updated successfully, but these errors were encountered: