Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

MongoDB .update should merge data #1

Closed
ekryski opened this issue Apr 10, 2014 · 7 comments · Fixed by #7
Closed

MongoDB .update should merge data #1

ekryski opened this issue Apr 10, 2014 · 7 comments · Fixed by #7

Comments

@ekryski
Copy link
Member

ekryski commented Apr 10, 2014

It seems as if calling .update on the MongoDB service is replacing the data instead of merging it.

@daffl
Copy link
Member

daffl commented Apr 10, 2014

That might be ok now since we have service.patch which should do the merging.

@ekryski
Copy link
Member Author

ekryski commented Apr 10, 2014

If we are sticking to the REST verbs then .patch and .update should probably behave the same.

@daffl
Copy link
Member

daffl commented Apr 10, 2014

Well update maps to PUT which technically replaces the resource where PATCH merges it. From the spec (RFC 5789):

The PUT method is already defined to overwrite a resource with a complete new body, and cannot be reused to do partial changes.

...

The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI.

@ekryski
Copy link
Member Author

ekryski commented Jun 5, 2014

ok fair enough then update should replace and patch should merge them.

@daffl
Copy link
Member

daffl commented Jun 6, 2014

Yep. And for patch we can just use { $set: data } right?

@ekryski
Copy link
Member Author

ekryski commented Jun 6, 2014

yes I believe so. I'll have to double check the docs. It's been a while for me.

@daffl
Copy link
Member

daffl commented Jun 23, 2014

Closed via #5 for implementing .patch

@daffl daffl closed this as completed Jun 23, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants