本文整理汇总了Java中org.jongo.MongoCollection.remove方法的典型用法代码示例。如果您正苦于以下问题:Java MongoCollection.remove方法的具体用法?Java MongoCollection.remove怎么用?Java MongoCollection.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jongo.MongoCollection
的用法示例。
在下文中一共展示了MongoCollection.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateUser
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Test
public void testCreateUser() {
UserAccount userAccount = new UserAccount();
userAccount.setUserName("test");
userAccount.setPassword("password");
userAccount.setAuthorities(new String[] {AUTH_USER});
userAccount.setCollections(new ArrayList<String>() {{ add("test-collection"); }});
ResponseEntity<Void> responseEntity = restTemplate
.withBasicAuth("wh_client", "wh_secret")
.postForEntity("/api/v1/user/create", userAccount, Void.class);
assertNotNull(responseEntity);
assertEquals(responseEntity.getStatusCodeValue(), 200);
MongoCollection collection = jongo.getCollection(USER_REPO);
UserAccount account = collection.findOne("{userName: 'test'}").as(UserAccount.class);
assertEquals(account, userAccount);
collection.remove("{userName: 'test'}");
}
示例2: writeFuncParseRecord
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void writeFuncParseRecord(String moduleName, String funcName,
String version, long moduleVersion, String parseText) throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_FUNC_PARSE);
recs.remove("{moduleName:#,funcName:#,version:#}", moduleName, funcName, version);
FuncRecord rec = new FuncRecord();
rec.setModuleName(moduleName);
rec.setFuncName(funcName);
rec.setVersion(version);
rec.setModuleVersion(moduleVersion);
rec.setDocument(parseText);
recs.save(rec);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例3: writeTypeParseRecord
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void writeTypeParseRecord(String moduleName, String typeName,
String version, long moduleVersion, String document) throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_TYPE_PARSE);
recs.remove("{moduleName:#,typeName:#,version:#}", moduleName, typeName, version);
TypeRecord rec = new TypeRecord();
rec.setModuleName(moduleName);
rec.setTypeName(typeName);
rec.setVersion(version);
rec.setModuleVersion(moduleVersion);
rec.setDocument(document);
recs.save(rec);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例4: writeTypeSchemaRecord
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void writeTypeSchemaRecord(String moduleName, String typeName,
String version, long moduleVersion, String document, String md5) throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_TYPE_SCHEMA);
recs.remove("{moduleName:#,typeName:#,version:#}", moduleName, typeName, version);
TypeRecord rec = new TypeRecord();
rec.setModuleName(moduleName);
rec.setTypeName(typeName);
rec.setVersion(version);
rec.setModuleVersion(moduleVersion);
rec.setDocument(document);
rec.setMd5hash(md5);
recs.insert(rec);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例5: send
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void send() {
Map<String, T> jobs = getJobs();
MongoCollection collection = mongoDBService.getCollection(Constants.DB.TO_SEND);
for (Map.Entry<String, T> entry : jobs.entrySet()) {
String toSendQuery = "{jobId:'" + entry.getKey() + "'}";
try {
MongoCursor<ToSend> messageCursor = collection.find(toSendQuery).as(ToSend.class);
for (ToSend message : messageCursor) {
send(entry.getValue(), message);
}
collection.remove(toSendQuery);
messageCursor.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例6: cleanUp
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@After
public void cleanUp() {
restTemplate.withBasicAuth("wh_client", "wh_secret")
.delete("/api/v1/user/delete/test");
MongoCollection collection = jongo.getCollection(USER_REPO);
collection.remove("{userName: 'wh_client'}");
}
示例7: addOwnerToModule
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void addOwnerToModule(String moduleName, String userId,
boolean withChangeOwnersPrivilege) throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_OWNER);
recs.remove("{moduleName:#,ownerUserId:#}", moduleName, userId);
OwnerInfo rec = new OwnerInfo();
rec.setOwnerUserId(userId);
rec.setWithChangeOwnersPrivilege(withChangeOwnersPrivilege);
rec.setModuleName(moduleName);
recs.insert(rec);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例8: removeNewModuleRegistrationRequest
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void removeNewModuleRegistrationRequest(String moduleName,
String userId) throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_REQUEST);
recs.remove("{moduleName:#,ownerUserId:#}", moduleName, userId);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例9: removeOwnerFromModule
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@Override
public void removeOwnerFromModule(String moduleName, String userId)
throws TypeStorageException {
try {
MongoCollection recs = jdb.getCollection(TABLE_MODULE_OWNER);
recs.remove("{moduleName:#,ownerUserId:#}", moduleName, userId);
} catch (Exception e) {
throw new TypeStorageException(e);
}
}
示例10: unregisterPlugin
import org.jongo.MongoCollection; //导入方法依赖的package包/类
protected void unregisterPlugin() {
MongoCollection collection = getCollection();
final String type = configTemplate.getType();
LOGGER.info("Try to unregister plugin [{}]", type);
collection.remove(String.format("{type: '%s'}", type));
LOGGER.info("Plugin [{}] was removed successfully.", type);
if (Constants.DEBUG && testData != null && testData.size() > 0) {
MongoCollection testCollection = mongoDBService.getCollection(getConfigTableName());
for (T item : testData) {
String query = String.format("{id : '%s'}", item.getId());
testCollection.remove(query);
}
}
}
示例11: doRemove
import org.jongo.MongoCollection; //导入方法依赖的package包/类
private void doRemove(MongoCollection collection, String opQuery, Object[] parameters) throws DataServiceFault {
if (opQuery != null) {
if (parameters.length > 0) {
collection.remove(opQuery, parameters);
} else {
collection.remove(opQuery);
}
} else {
throw new DataServiceFault("Mongo remove statements must contain a query");
}
}
示例12: clear
import org.jongo.MongoCollection; //导入方法依赖的package包/类
public void clear(String collection) {
MongoCollection mongoCollection = jongo.getCollection(collection);
mongoCollection.remove();
}
示例13: cleanUp
import org.jongo.MongoCollection; //导入方法依赖的package包/类
@After
public void cleanUp() {
MongoCollection collection = jongo.getCollection(USER_REPO);
collection.remove("{userName: 'wh_client'}");
}
示例14: delete
import org.jongo.MongoCollection; //导入方法依赖的package包/类
/**
* Deletes the User with a matching id from the database
* @param id Id of the User to be deleted
*/
public void delete(String id) {
MongoCollection collection = db.getClient().getCollection("users");
collection.remove(new ObjectId(id));
}
示例15: deleteAllImages
import org.jongo.MongoCollection; //导入方法依赖的package包/类
/**
* Deletes all images connected to a certain event.
*
* @param path The unique path that identifies the event.
*/
@Override
public void deleteAllImages(String path) {
MongoCollection collection = client.getClient().getCollection("images");
collection.remove("{path: '" + path + "'}");
}