当前位置: 首页>>代码示例>>Java>>正文


Java MongoCollection.remove方法代码示例

本文整理汇总了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'}");
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:21,代码来源:DataGateUserTest.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:18,代码来源:MongoTypeStorage.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:18,代码来源:MongoTypeStorage.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:19,代码来源:MongoTypeStorage.java

示例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();
        }

    }
}
 
开发者ID:eliogrin,项目名称:CISEN,代码行数:20,代码来源:AbstractMessenger.java

示例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'}");
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:9,代码来源:DataGateSyncTest.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:16,代码来源:MongoTypeStorage.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:MongoTypeStorage.java

示例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);
	}
}
 
开发者ID:kbase,项目名称:workspace_deluxe,代码行数:11,代码来源:MongoTypeStorage.java

示例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);
        }
    }
}
 
开发者ID:eliogrin,项目名称:CISEN,代码行数:16,代码来源:AbstractPlugin.java

示例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");
    }
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:12,代码来源:MongoQuery.java

示例12: clear

import org.jongo.MongoCollection; //导入方法依赖的package包/类
public void clear(String collection) {
    MongoCollection mongoCollection = jongo.getCollection(collection);
    mongoCollection.remove();
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:5,代码来源:ReplicaStoreService.java

示例13: cleanUp

import org.jongo.MongoCollection; //导入方法依赖的package包/类
@After
public void cleanUp() {
    MongoCollection collection = jongo.getCollection(USER_REPO);
    collection.remove("{userName: 'wh_client'}");
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:6,代码来源:DataGateUserTest.java

示例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));
}
 
开发者ID:2DV603NordVisaProject,项目名称:nordvisa_calendar,代码行数:9,代码来源:UserDAOMongo.java

示例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 + "'}");
}
 
开发者ID:2DV603NordVisaProject,项目名称:nordvisa_calendar,代码行数:11,代码来源:ImageDAOMongo.java


注:本文中的org.jongo.MongoCollection.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。