diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-07-12 17:20:35 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-07-12 17:20:42 -0400 |
commit | 3dd9e521192458002efc7ddaaa7455bcc549afd6 (patch) | |
tree | 9e7bb07d8381d6b52568343d0370de66818d8502 /src | |
parent | ab01f6fc3c50279953838d675067083a8cf0799f (diff) |
handle new_edits=false update_doc response correctly
Diffstat (limited to 'src')
-rw-r--r-- | src/fabric.erl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/fabric.erl b/src/fabric.erl index 9158b9e9..9b74b691 100644 --- a/src/fabric.erl +++ b/src/fabric.erl @@ -70,12 +70,15 @@ get_missing_revs(DbName, IdsRevs) when is_list(IdsRevs) -> fabric_doc_missing_revs:go(dbname(DbName), Sanitized). update_doc(DbName, Doc, Options) -> - {ok, [Result]} = update_docs(DbName, [Doc], opts(Options)), - case Result of - {ok, _} -> - Result; - Error -> - throw(Error) + case update_docs(DbName, [Doc], opts(Options)) of + {ok, [{ok, NewRev}]} -> + {ok, NewRev}; + {ok, [Error]} -> + throw(Error); + {ok, []} -> + % replication success + #doc{revs = {Pos, [RevId | _]}} = doc(Doc), + {ok, {Pos, RevId}} end. update_docs(DbName, Docs, Options) -> |