a method to delete a view associated with a user design doc
        
        :param query_criteria: [optional] dictionary with valid jsonmodel query criteria
        :param uid: [optional] string with uid of design document to update
        :return: integer with status of operation
                
        an example of how to construct the query_criteria argument:

        query_criteria = {
            '.path.to.number': {
                'min_value': 4.5
            },
            '.path.to.string': {
                'discrete_values': [ 'pond', 'lake', 'stream', 'brook' ]
            }
        }
        
        NOTE:   only fields specified in the document schema at class initialization
                can be used as fields in query_criteria. otherwise, an error will be thrown.
                uid is automatically added to all document schemas at initialization
                
        NOTE:   the full list of all criteria are found in the reference page for the
                jsonmodel module as well as the query-rules.json file included in the
                module. 
                http://collectiveacuity.github.io/jsonModel/reference/#query-criteria

        NOTE:   if a query_criteria is not specified, then the entire user design doc is removed
                otherwise, the existing design document is updated.

def delete_view(self, query_criteria=None, uid='_all_users'):
    
        '''
            a method to delete a view associated with a user design doc
        
        :param query_criteria: [optional] dictionary with valid jsonmodel query criteria
        :param uid: [optional] string with uid of design document to update
        :return: integer with status of operation
                
        an example of how to construct the query_criteria argument:

        query_criteria = {
            '.path.to.number': {
                'min_value': 4.5
            },
            '.path.to.string': {
                'discrete_values': [ 'pond', 'lake', 'stream', 'brook' ]
            }
        }
        
        NOTE:   only fields specified in the document schema at class initialization
                can be used as fields in query_criteria. otherwise, an error will be thrown.
                uid is automatically added to all document schemas at initialization
                
        NOTE:   the full list of all criteria are found in the reference page for the
                jsonmodel module as well as the query-rules.json file included in the
                module. 
                http://collectiveacuity.github.io/jsonModel/reference/#query-criteria

        NOTE:   if a query_criteria is not specified, then the entire user design doc is removed
                otherwise, the existing design document is updated. 
        '''
        
    # https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/query/delete__db___design__ddoc_
    
        title = '%s.delete_view' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'uid': uid
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # validate inputs
        if query_criteria:
            if not self.model:
                raise ValueError('%s(query_criteria={...} requires a document_schema.' % title)
            self.model.query(query_criteria)
        else:
            query_criteria = {}
        if uid != '_all_users' and self.public:
            raise ValueError('%s(uid="%s") user ids are not applicable for a public bucket. % title')
            
    # handle deleting user design doc
        if not query_criteria:
            url = self.bucket_url + '/_design/%s' % uid
            response = requests.delete(url)
    
    # catch missing args
        elif not uid:
            raise IndexError('%s requires either a uid or query_criteria argument.' % title)
    
    # handle removing a view from a design doc
        else:
            
    # determine hash of query criteria
            import hashlib
            import json
            hashed_criteria = hashlib.md5(json.dumps(query_criteria, sort_key=True).encode('utf-8')).hexdigest()

    # determine design document to update
            url = self.bucket_url + '/_design/%s' % uid
    
    # remove view from design document and update
            response = requests.get(url)
            if response.status_code in (200, 201):
                design_details = response.json()
                design_details['views'] = self._clean_views(design_details['views'])
                if hashed_criteria in design_details['views'].keys():
                    del design_details['views'][hashed_criteria]
                if design_details['views']:
                    response = requests.put(url, json=design_details)
                else:
                    response = requests.delete(url)

        return response.status_code