Delete a document
189839
def del_doc(self, doc):
        
        logger.info("Removing doc from the index: %s" % doc)
        doc = doc.clone()  # make sure it can be serialized safely
        self.docsearch.index.del_doc(doc)
682639
def destroy(bulk=false)
      caught = catch(:halt)  do
        _run_destroy_callbacks do
          result = database.delete_doc(self, bulk)
          if result['ok']
            self.delete('_rev')
            self.delete('_id')
          end
          result['ok']
        end
      end
    end
398888
def delete_token(self):
        
        try:
            self.doc_ref.delete()
        except Exception as e:
            log.error('Could not delete the token (key: {}): {}'.format(self.doc_id, str(e)))
            return False
        return True
371932
async def delete(self, _id=None):
		
		if not _id:
			return {"error":400, 
					"reason":"Missed required fields"}

		document = await self.collection.find_one({"id": _id})

		if not document:
			return {"error":404, 
					"reason":"Not found"}

		deleted_count = await self.collection.delete_one(
							{"id": _id}).deleted_count

		return deleted_count
423978
def delete(cls, uuid):
        """"""
        to_delete = Workflow.query.get(uuid)
        db.session.delete(to_delete)
1347233
def _delete(
            self, sock_info, criteria, multi,
            write_concern=None, op_id=None, ordered=True,
            collation=None, session=None, retryable_write=False):
        """"""
        common.validate_is_mapping("filter", criteria)
        write_concern = write_concern or self.write_concern
        acknowledged = write_concern.acknowledged
        delete_doc = SON([('q', criteria),
                          ('limit', int(not multi))])
        collation = validate_collation_or_none(collation)
        if collation is not None:
            if sock_info.max_wire_version < 5:
                raise ConfigurationError(
                    'Must be connected to MongoDB 3.4+ to use collations.')
            elif not acknowledged:
                raise ConfigurationError(
                    'Collation is unsupported for unacknowledged writes.')
            else:
                delete_doc['collation'] = collation
        command = SON([('delete', self.name),
                       ('ordered', ordered),
                       ('deletes', [delete_doc])])
        if not write_concern.is_server_default:
            command['writeConcern'] = write_concern.document

        if not sock_info.op_msg_enabled and not acknowledged:
            # Legacy OP_DELETE.
            return self._legacy_write(
                sock_info, 'delete', command, op_id,
                False, message.delete, self.__full_name, criteria,
                False, write_concern.document,
                self.__write_response_codec_options,
                int(not multi))
        # Delete command.
        result = sock_info.command(
            self.__database.name,
            command,
            write_concern=write_concern,
            codec_options=self.__write_response_codec_options,
            session=session,
            client=self.__database.client,
            retryable_write=retryable_write)
        _check_write_command_response(result)
        return result
68436
def cleanup_on_delete(self, sender, document, **kwargs):
        '''
        
        '''
        if not self.follow or sender is not self.owner_document:
            return
        slug = getattr(document, self.db_field)
        namespace = self.owner_document.__name__
        SlugFollow.objects(namespace=namespace, new_slug=slug).delete()
295799
def delete(self, id):
        
        res = self._api_request('del', data={'i': id})[0]
        if res[0] == '-1':
            raise PuushError("File deletion failed.")
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})
235040
def remove(self, document_id, namespace, timestamp):
        
        self.solr.delete(id=u(document_id),
                         commit=(self.auto_commit_interval == 0))
1245901
function destroyDoc (docName, rev, callback) {
      if (!docName) {
        const msg = 'Invalid doc id'
        if (callback) {
          callback(msg, null)
        } else {
          return Promise.reject(msg)
        }
      } else {
        return relax({
          db: dbName,
          doc: docName,
          method: 'DELETE',
          qs: { rev: rev }
        }, callback)
      }
    }
147124
def delete(filething):
    

    t = OggTheora(filething)
    filething.fileobj.seek(0)
    t.delete(filething)
76572
private DocumentChange deleteDoc(QueryDocumentSnapshot oldDocument) {
    ResourcePath resourcePath = oldDocument.getReference().getResourcePath();
    int oldIndex = documentSet.indexOf(resourcePath);
    documentSet = documentSet.remove(resourcePath);
    return new DocumentChange(oldDocument, Type.REMOVED, oldIndex, -1);
  }
383091
function(docs, callback) {
				remaining = docs;
				console.log('[ remove ] info: ' + remaining +' to remove.');
				async.eachLimit(_.range(0, docs, 10000), 1, handleOneBlock, callback);
			}
498376
def delete(self, count=1):
        
        if self.cursor_position < len(self.text):
            deleted = self.document.text_after_cursor[:count]
            self.text = self.text[:self.cursor_position] + \
                self.text[self.cursor_position + len(deleted):]
            return deleted
        else:
            return ''
646614
def _pre_delete_hook(cls, key):
        
        if cls.searching_enabled:
            doc_id = cls.search_get_document_id(key)
            index = cls.search_get_index()
            index.delete(doc_id)
616136
function cleanDocs(docs) {
  for (var i = 0; i < docs.length; i++) {
    var doc = docs[i];
    if (doc._deleted) {
      delete doc._attachments; // ignore atts for deleted docs
    } else if (doc._attachments) {
      // filter out extraneous keys from _attachments
      var atts = Object.keys(doc._attachments);
      for (var j = 0; j < atts.length; j++) {
        var att = atts[j];
        doc._attachments[att] = pouchdbUtils.pick(doc._attachments[att],
          ['data', 'digest', 'content_type', 'length', 'revpos', 'stub']);
      }
    }
  }
}