Hi dev list, Damien,

I noticed when a database has multiple design docs with a
`validate_doc_update` function each. The validation functions
are called in the reverse string collation order of the design
document's id.

The function in `_design/b` gets executed before the one
in `_design/a`, which comes before `_design/1`.

The relevant code is in couch_db_update.erl:

get_design_docs(#db{fulldocinfo_by_id_btree=Btree}=Db) ->
    couch_btree:foldl(Btree, <<"_design/">>,
fun(#full_doc_info{id= <<"_design/",_/binary>>}=FullDocInfo, _Reds, AccDocs) ->
            {ok, [couch_db:make_doc(Db, FullDocInfo) | AccDocs]};
        (_, _Reds, AccDocs) ->
            {stop, AccDocs}
        end,
        []).

Reversing the order of design docs in the AccDocs variable is
easy. The question is which behaviour do we want or is there
a reason for the reverse-rule?

Cheers
Jan
--

Reply via email to