Beispiel #1
0
    def remove(self, safe=True, callback=None):
        """Remove a document

        :Parameters:
        - `safe` (optional): safe remove operation
        - `callback` : method which will be called when remove is finished
        """
        pre_remove.send(instance=self)

        client = Client(Database(), self.__collection__)
        response, error = yield gen.Task(client.remove, self._id, safe=safe)

        post_remove.send(instance=self)

        if callback:
            callback((response, error))
Beispiel #2
0
    def remove(self, safe=True, callback=None):
        """Remove a document

        :Parameters:
        - `safe` (optional): safe remove operation
        - `callback` : method which will be called when remove is finished
        """
        pre_remove.send(instance=self)

        client = Client(Database(), self.__collection__)
        response, error = yield gen.Task(client.remove, self._id, safe=safe)

        post_remove.send(instance=self)

        if callback:
            callback((response, error))
Beispiel #3
0
    def remove(self, safe=True, callback=None):
        """Remove a document

        :Parameters:
        - `safe` (optional): safe remove operation
        - `callback` : method which will be called when remove is finished
        """
        pre_remove.send(instance=self)

        database = Database()
        collection_name = database.get_collection_name(self.__collection__)

        message_delete = message.delete(collection_name, {'_id': self._id},
            safe, {})

        response, error = yield gen.Task(database.send_message, message_delete)

        post_remove.send(instance=self)

        if callback:
            callback((response, error))