Protected a recursive call in CouchDB defs