benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

couchbeam_doc:extend should override existing fields instead of duplicating keys #16

Closed benbro closed 14 years ago

benbro commented 14 years ago

When using couchbeam_doc:extend(PropList, Doc) and saving the doc, I'm getting a doc with duplicated fields. This can easily be checked with couchbeam_db:open_doc. The web admin doesn't show duplicated fields.

A possible fix is: NewProps2 = [{Key, proplists:get_value(Key,NewProps,Val)} || {Key,Val} <- OldProps]

OldProps is from the Doc and NewProps are the props you want to append/override

benoitc commented 14 years ago

fixed in latest head. thanks!