Delete multiple documents
979420
def delete_many(cls, documents):
        """"""

        # Ensure all documents have been converted to frames
        frames = cls._ensure_frames(documents)

        all_count = len(documents)
        assert len([f for f in frames if '_id' in f._document]) == all_count, \
                "Can't delete documents without `_id`s"

        # Send delete signal
        signal('delete').send(cls, frames=frames)

        # Prepare the documents to be deleted
        ids = [f._id for f in frames]

        # Delete the documents
        cls.get_collection().delete_many({'_id': {'$in': ids}})

        # Send deleted signal
        signal('deleted').send(cls, frames=frames)
416343
def invalidate(self, context, sid):
		""""""
		
		result = self._Document.get_collection().delete_one({'_id': sid})
		
		return result.deleted_count == 1
175418
def clear_document(self):
        
        self._components.clear()
        self._sequences.clear()
        self._namespaces.clear()
        self._models.clear()
        self._modules.clear()
        self._collections.clear()
        self._annotations.clear()
        self._functional_component_store.clear()
        self._collection_store.clear()
78847
def remove(self, document_id, namespace, timestamp):
        
        database, coll = self._db_and_collection(namespace)

        meta_collection = self._get_meta_collection(namespace)

        doc2 = self.meta_database[meta_collection].find_one_and_delete(
            {self.id_field: document_id}
        )
        if doc2 and doc2.get("gridfs_id"):
            GridFS(self.mongo[database], coll).delete(doc2["gridfs_id"])
        else:
            self.mongo[database][coll].delete_one({"_id": document_id})
367184
def remove(self, cond=None, doc_ids=None, eids=None):
        
        doc_ids = _get_doc_ids(doc_ids, eids)

        if cond is None and doc_ids is None:
            raise RuntimeError('Use purge() to remove all documents')

        return self.process_elements(
            lambda data, doc_id: data.pop(doc_id),
            cond, doc_ids
        )
1276806
function deleteFiles(files) {
	_.castArray(files).forEach(file => {
		if (!fs.existsSync(file)) {
			return;
		}

		log.removed(`Delete ${file}`);
		fs.removeSync(file);
	});
}
350348
def delete_many(self, **kwargs):
        
        db_objects = self.get_dbcollection_with_es(**kwargs)
        return self.Model._delete_many(db_objects, self.request)
689938
def delete_files(paths):
    
    for path in paths:
        if os.path.exists(path):
            os.remove(path)
239044
def delete(self, **kwargs):
        
        if self.is_valid:
            if '_id' in self._document:
                to_delete = self.find_one({'_id': self._id})

                if to_delete:
                    before = self.before_delete()
                    if before:
                        return before

                    try:
                        self.delete_one({'_id': self._id})

                        self.after_delete()

                        return self._document
                    except PyMongoException as exc:
                        return PyMongoError(
                            error_message=exc.details.get(
                                'errmsg', exc.details.get(
                                    'err', 'PyMongoError.'
                                )
                            ),
                            operation='delete', collection=type(self).__name__,
                            document=self._document,
                        )
                else:
                    return DocumentNotFoundError(type(self).__name__, self._id)
            else:
                return UnidentifiedDocumentError(
                    type(self).__name__, self._document
                )
1011055
public static function tearDown()
    {
        $dm = static::$dm;

        if (is_null($dm)) {
            return;
        }

        $documents = [
            'Applications\Entity\Application',
            'Cv\Entity\Cv',
            'Jobs\Entity\Job',
            'Organizations\Entity\Organization',
            'Auth\Entity\User',
            'Jobs\Entity\Category',
            'Auth\Entity\UserImage',
            'Organizations\Entity\OrganizationName',
        ];
        foreach ($documents as $document) {
            try {
                $dm->createQueryBuilder($document)
                    ->remove()
                    ->getQuery()
                    ->execute()
                ;
            } catch (\Exception $e) {
            }
        }
    }
963893
def deleteAll(self):
        
        for core in self.endpoints:
            self._send_solr_command(self.endpoints[core], "{\"delete\": { \"query\" : \"*:*\"}}")
1210006
def _deleteObject(self, xref):
        """"""
        if self.isClosed:
            raise ValueError("operation illegal for closed doc")

        return _fitz.Document__deleteObject(self, xref)
1137437
def delete_document(project_id, knowledge_base_id, document_id):
    """"""
    import dialogflow_v2beta1 as dialogflow
    client = dialogflow.DocumentsClient()
    document_path = client.document_path(project_id, knowledge_base_id,
                                         document_id)

    response = client.delete_document(document_path)
    print('operation running:\n {}'.format(response.operation))
    print('Waiting for results...')
    print('Done.\n {}'.format(response.result()))
1030126
function (options, callback) {
  var Deleter = {}
  // Delete all docs with the IDs found in deleteBatch
  Deleter.deleteBatch = function (deleteBatch, APICallback) {
    tryDeleteBatch(options, deleteBatch, function (err) {
      return APICallback(err)
    })
  }
  // Flush the db (delete all entries)
  Deleter.flush = function (APICallback) {
    flush(options, function (err) {
      return APICallback(err)
    })
  }
  return callback(null, Deleter)
}
889636
def delete(self, docids):
        """"""
        self.check_session()
        result = self.session.delete(docids)
        if self.autosession:
            self.commit()
        return result
1334533
def remove_many(self, it):
        """"""
        # find indicies of objects in iterable
        to_be_deleted = list(it)
        del_indices = []
        for i, ob in enumerate(self.obs):
            try:
                tbd_index = to_be_deleted.index(ob)
            except ValueError:
                continue
            else:
                del_indices.append(i)
                to_be_deleted.pop(tbd_index)

            # quit early if we have found them all
            if not to_be_deleted:
                break

        for i in sorted(del_indices, reverse=True):
            self.pop(i)

        return self
1292535
function skip() {
    rimraf(file, function() {})
    delete f.versions[v]
    if (f._attachments)
      delete f._attachments[file]
    need.splice(need.indexOf(v), 1)
    maybeDone(null)
  }