#NEWLINE# def get_doc_count_by_type( db , doc_type ) : #NEWLINE# #INDENT# key = [ db ] #NEWLINE# result = db . view ( 'all_docs/by_doc_type' , startkey = key , endkey = ( key + [ { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ] ) , reduce = True , group_level = 1 ) . one ( ) #NEWLINE# if result : #NEWLINE# #INDENT# return result [ 'value' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return 0