# File lib/chef/couchdb.rb, line 212 def find_by_name(obj_type, name, with_id=false) r = get_view("id_map", "name_to_id", :key => [ obj_type, name ], :include_docs => true) if r["rows"].length == 0 raise Chef::Exceptions::CouchDBNotFound, "Cannot find #{obj_type} #{name} in CouchDB!" end if with_id [ r["rows"][0]["doc"], r["rows"][0]["id"] ] else r["rows"][0]["doc"] end end