I've seen this logic in nearly all the templates. (document_view, db_view, collection_view and so on). I'd propose to fix this in another pull request since it's a general purpose question.