benoitc / couchbeam

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

API/Replace & Create Documents #27

Closed aheissenberger closed 14 years ago

aheissenberger commented 14 years ago

Which API Function can be used to simulate the SQL command REPLACE which will create a new Document if the primary key does not exist, else it updates the existing record.

benoitc commented 14 years ago

save_doc does exactly that.

aheissenberger commented 14 years ago

Yes, but only if I include the latest revision ID which means that I have to do a request to coachdb for each record to check if it exist. take the IDrev an and it to the new local data and then save it with "save_doc". I know this behavor is part of the native couchdb API but wouldn´t it make sense to offer this as an optional parameter in your API?