Skip to content

Commit

Permalink
del_doc by id
Browse files Browse the repository at this point in the history
  • Loading branch information
lazedo committed Mar 4, 2016
1 parent 56dae8a commit 7c2d1c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/kazoo_data/src/kzs_doc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ ensure_saved(#{server := {App, Conn}}, DbName, Doc, Options) ->
-spec del_doc(map(), ne_binary(), wh_json:object() | ne_binary(), wh_proplist()) ->
{'ok', wh_json:objects()} |
data_error().
del_doc(Server, DbName, DocId, Options)
when is_binary(DocId) ->
case lookup_doc_rev(Server, DbName, DocId) of
{'error', _}=Err -> Err;
{'ok', Rev} ->
JObj = wh_json:from_list([{<<"_id">>, DocId}
,{<<"_rev">>, Rev}
]),
del_doc(Server, DbName, JObj, Options)
end;
del_doc(#{server := {App, Conn}}, DbName, Doc, Options) ->
kzs_cache:flush_cache_doc(DbName, Doc),
App:del_doc(Conn, DbName, Doc, Options).
Expand Down

0 comments on commit 7c2d1c5

Please sign in to comment.