labpack/databases/couchbase.py
def purge(self, doc_ids):

        '''
            a method to remove docs from the collection
            
        :param doc_ids: string or list of strings with document ids to purge 
        :return: list of strings of doc ids purged
        '''
        
        # https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/document/post__db___purge
    
        title = '%s.purge' % self.__class__.__name__
        
    # ingest arguments
        if isinstance(doc_ids, str):
            doc_ids = [ doc_ids ]
        
    # validate inputs
        input_fields = {
            'doc_ids': doc_ids
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # construct request fields
        url = self.bucket_url + '/_purge'
        json_body = {}
        for doc in doc_ids:
            json_body[doc] = [ "*" ]
    
    # send request 
        response = requests.post(url, json=json_body)

    # construct output from response
        purged_list = []
        purged_map = {}
        response_details = response.json()
        if 'purged' in response_details.keys():
            purged_map = response_details['purged']
        for key in purged_map.keys():
            purged_list.append(key)
        
        return purged_list

            a method to remove docs from the collection
            
        :param doc_ids: string or list of strings with document ids to purge 
        :return: list of strings of doc ids purged
        
a method to remove docs from the collection
a method to remove docs from the collection
def purge(self, doc_ids):
        title = '%s.purge' % self.__class__.__name__
        if isinstance(doc_ids, str):
            doc_ids = [ doc_ids ]
        input_fields = {
            'doc_ids': doc_ids
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
        url = self.bucket_url + '/_purge'
        json_body = {}
        for doc in doc_ids:
            json_body[doc] = [ "*" ]
        response = requests.post(url, json=json_body)
        purged_list = []
        purged_map = {}
        response_details = response.json()
        if 'purged' in response_details.keys():
            purged_map = response_details['purged']
        for key in purged_map.keys():
            purged_list.append(key)
        return purged_list
def purge ( self , doc_ids ) : title = '%s.purge' % self . __class__ . __name__ if isinstance ( doc_ids , str ) : doc_ids = [ doc_ids ] input_fields = { 'doc_ids' : doc_ids } for key , value in input_fields . items ( ) : object_title = '%s(%s=%s)' % ( title , key , str ( value ) ) self . fields . validate ( value , '.%s' % key , object_title ) url = self . bucket_url + '/_purge' json_body = { } for doc in doc_ids : json_body [ doc ] = [ "*" ] response = requests . post ( url , json = json_body ) purged_list = [ ] purged_map = { } response_details = response . json ( ) if 'purged' in response_details . keys ( ) : purged_map = response_details [ 'purged' ] for key in purged_map . keys ( ) : purged_list . append ( key ) return purged_list
a method to remove docs from the collection
a method to remove docs from the collection
'''
            a method to remove docs from the collection
            
        :param doc_ids: string or list of strings with document ids to purge 
        :return: list of strings of doc ids purged
        ''' # https://developer.couchbase.com/documentation/mobile/1.5/references/sync-gateway/admin-rest-api/index.html#/document/post__db___purge # ingest arguments # validate inputs # construct request fields # send request  # construct output from response
list of strings of doc ids purged
list of strings of doc ids purged
self
doc_ids
string or list of strings with document ids to purge
string or list of strings with document ids to purge