diff options
-rw-r--r-- | src/couchdb/couch_doc.erl | 19 | ||||
-rw-r--r-- | src/couchdb/couch_rep.erl | 2 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl index 9b7d6db9..61685cfa 100644 --- a/src/couchdb/couch_doc.erl +++ b/src/couchdb/couch_doc.erl @@ -110,13 +110,18 @@ from_json_obj({obj, Props}) -> Revs0 -> Revs0 end, - #doc{ - id = proplists:get_value("_id", Props, ""), - revs = Revs, - deleted = proplists:get_value("_deleted", Props, false), - body = {obj, [{Key, Value} || {[FirstChar|_]=Key, Value} <- Props, FirstChar /= $_]}, - attachments = Bins - }. + case proplists:get_value("_id", Props, "") of + Id when is_list(Id) -> + #doc{ + id = Id, + revs = Revs, + deleted = proplists:get_value("_deleted", Props, false), + body = {obj, [{Key, Value} || {[FirstChar|_]=Key, Value} <- Props, FirstChar /= $_]}, + attachments = Bins + }; + _ -> + throw({invalid_document_id, "Document id is not a string"}) + end. to_doc_info(#full_doc_info{id=Id,update_seq=Seq,rev_tree=Tree}) -> diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 452bb492..b2d46beb 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -241,7 +241,7 @@ open_db(DbName)-> enum_docs_since(DbUrl, StartSeq, InFun, InAcc) when is_list(DbUrl) -> - Url = DbUrl ++ "_all_docs_by_seq?count=4&startkey=" ++ integer_to_list(StartSeq), + Url = DbUrl ++ "_all_docs_by_seq?count=100&startkey=" ++ integer_to_list(StartSeq), {obj, Results} = do_http_request(Url, get), DocInfoList= lists:map(fun({obj, RowInfoList}) -> |