本文整理了Java中com.mongodb.gridfs.GridFS.remove()
方法的一些代码示例,展示了GridFS.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridFS.remove()
方法的具体详情如下:
包路径:com.mongodb.gridfs.GridFS
类名称:GridFS
方法名:remove
[英]Removes all files matching the given query.
[中]删除与给定查询匹配的所有文件。
代码示例来源:origin: org.mongodb/mongo-java-driver
/**
* Removes all files matching the given filename.
*
* @param filename the name of the file to be removed
* @throws com.mongodb.MongoException if the operation fails
*/
public void remove(final String filename) {
if (filename == null) {
throw new IllegalArgumentException("filename can not be null");
}
remove(new BasicDBObject("filename", filename));
}
代码示例来源:origin: org.mongodb/mongodb-driver
/**
* Removes all files matching the given filename.
*
* @param filename the name of the file to be removed
* @throws com.mongodb.MongoException if the operation fails
*/
public void remove(final String filename) {
if (filename == null) {
throw new IllegalArgumentException("filename can not be null");
}
remove(new BasicDBObject("filename", filename));
}
代码示例来源:origin: apache/incubator-wave
@Override
public void deleteAttachment(AttachmentId attachmentId) {
attachmentGrid.remove(attachmentId.serialise());
thumbnailGrid.remove(attachmentId.serialise());
metadataGrid.remove(attachmentId.serialise());
}
代码示例来源:origin: Findwise/Hydra
@Override
public boolean deleteFile(Object id) {
DBObject obj = new BasicDBObject(MongoDocument.MONGO_ID_KEY, id);
if (pipelinefs.find(obj).size()==0) {
return false;
}
pipelinefs.remove(obj);
return true;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void remove(Query query) {
__gridFS.remove(query.toBson());
}
}
代码示例来源:origin: Findwise/Hydra
@Override
public void deleteAll() {
documents.remove(new BasicDBObject());
documentfs.remove(new BasicDBObject());
}
代码示例来源:origin: org.craftercms/crafter-commons-mongo
@Override
public void deleteFile(final String storeName) throws FileNotFoundException {
gridfs.remove(validateObject(storeName));
}
代码示例来源:origin: BlackLabs/play-morphia
private void deleteLegacyBlobs() {
GridFS gfs = MorphiaPlugin.gridFs();
Pattern ptn = Pattern.compile(getIdAsStr());
gfs.remove(new BasicDBObject("name", ptn));
}
代码示例来源:origin: com.cognifide.aet/datastorage
@Override
public void removeArtifacts(DBKey dbKey, Set<String> artifactsToRemove) {
GridFS gfs = getGridFS(dbKey);
for (String artifactId : artifactsToRemove) {
LOGGER.debug("Removing artifact {} from {}", artifactId, dbKey);
gfs.remove(new ObjectId(artifactId));
}
}
代码示例来源:origin: Kurento/kurento-java
@Override
public void remove(RepositoryItem item) {
httpManager.disposeHttpRepoItemElemByItemId(item, "Repository Item removed");
gridFS.remove(item.getId());
}
代码示例来源:origin: org.kurento/kurento-repository-internal
@Override
public void remove(RepositoryItem item) {
httpManager.disposeHttpRepoItemElemByItemId(item, "Repository Item removed");
gridFS.remove(item.getId());
}
代码示例来源:origin: org.craftercms/crafter-commons-mongo
@Override
public FileInfo updateFile(final InputStream inputStream, final String storeName, final String contentType)
throws FileNotFoundException, MongoDataException, FileExistsException {
gridfs.remove(validateObject(storeName));
return saveFile(inputStream, storeName, contentType);
}
代码示例来源:origin: com.commercehub.jclouds/jclouds-gridfs-blobstore
@Override
public void removeBlob(String container, String name) {
parseGridFSIdentifier(container).connect(mongo).remove(name);
}
}
代码示例来源:origin: org.craftercms/crafter-commons-mongo
@Override
public FileInfo updateFile(final ObjectId fileId, final InputStream inputStream, final String storeName, final
String contentType, boolean sameFileId) throws FileNotFoundException, MongoDataException, FileExistsException {
gridfs.remove(validateObject(fileId));
return saveFile(inputStream, storeName, contentType, sameFileId? fileId: null);
}
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
@Override
public void removeBinary(DBRef ref) {
if (ref.getId() instanceof ObjectId) {
ObjectId objectId = (ObjectId) ref.getId();
gridfsAccessor.getGridFs().remove(objectId);
} else {
gridfsAccessor.getGridFs().remove(ref.getId().toString());
}
}
代码示例来源:origin: Findwise/Hydra
@Override
public boolean save(Object id, String fileName, InputStream file) {
pipelinefs.remove(new BasicDBObject(MongoDocument.MONGO_ID_KEY, id));
GridFSInputFile inputFile = pipelinefs.createFile(file, fileName);
inputFile.put("_id", id);
inputFile.save();
return true;
}
代码示例来源:origin: BlackLabs/play-morphia
@Override
public void remove(String key) {
gfs().remove(new BasicDBObject("name", key));
// the following line is to make sure the old blob data get removed
// the line will be removed in the next release
BlobStorageService.removeLater(BlobStorageService.getLegacyKey(key), this);
}
代码示例来源:origin: BlackLabs/play-morphia
@Override
public void put(String key, ISObject stuff) throws UnexpectedIOException {
GridFS gfs = gfs();
gfs.remove(new BasicDBObject("name", key));
GridFSInputFile inputFile = gfs.createFile(stuff.asByteArray());
inputFile.setContentType(stuff.getAttribute(Blob.CONTENT_TYPE));
inputFile.put("name", key);
inputFile.put("filename", stuff.getAttribute(Blob.FILENAME));
inputFile.save();
}
代码示例来源:origin: Findwise/Hydra
@Override
public boolean deleteDocumentFile(DatabaseDocument<MongoType> d, String fileName) {
MongoDocument md = (MongoDocument) d;
DBObject query = QueryBuilder.start(DOCUMENT_KEY).is(md.getID().getID()).and(FILENAME_KEY).is(fileName).get();
if (documentfs.getFileList(query).size() != 1) {
return false;
}
documentfs.remove(query);
return true;
}
代码示例来源:origin: liveoak-io/liveoak
public void delete(RequestContext ctx, Responder responder) throws Exception {
GridFSDBObject info = fileInfo();
if (info.getId() == null) {
responder.noSuchResource(id());
return;
}
GridFS gridfs = getUserspace().getGridFS();
gridfs.remove(info.getId());
info.dbObject().put("length", 0L);
info.dbObject().put("contentType", null);
responder.resourceDeleted(this);
}
内容来源于网络,如有侵权,请联系作者删除!