couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject validation functions
Date Sat, 17 Jan 2009 21:41:01 GMT
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}

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?


View raw message