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


Java DBCollection.drop方法代码示例

本文整理汇总了Java中com.mongodb.DBCollection.drop方法的典型用法代码示例。如果您正苦于以下问题:Java DBCollection.drop方法的具体用法?Java DBCollection.drop怎么用?Java DBCollection.drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mongodb.DBCollection的用法示例。


在下文中一共展示了DBCollection.drop方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dropTable

import com.mongodb.DBCollection; //导入方法依赖的package包/类
private int dropTable(SQLDropTableStatement state) {		
	for (SQLTableSource table : state.getTableSources()){
		DBCollection coll =this._db.getCollection(table.toString());
		coll.drop();
	}
	return 1;
	
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:9,代码来源:MongoSQLParser.java

示例2: remove

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Override
public Object remove(Key key) throws PageException {
	if(!containsKey(key.getString()))
		throw exp.createExpressionException("can't remove DBCollection with key ["+key+"], key doesn't exist");

	DBCollection coll = db.getCollection(key.getString());
	coll.drop();
	return toCFML(coll);
}
 
开发者ID:lucee,项目名称:extension-mongodb,代码行数:10,代码来源:DBImpl.java

示例3: clear

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Override
public void clear() {
	Iterator<Key> it = keyIterator();
	Key k;
	DBCollection coll;
	while(it.hasNext()){
		k=it.next();
		coll = db.getCollection(k.getString());
		coll.drop();
	}
}
 
开发者ID:lucee,项目名称:extension-mongodb,代码行数:12,代码来源:DBImpl.java

示例4: onRootAccess

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody Result onRootAccess() {

    DBCollection collection = mongoTemplate.getCollection("test");
    long count = collection.getCount();
    log.info("Object count in 'test' collection before insert: " + count + "<br/> Inserting one object.<br/>");

    BasicDBObject dBObject = new BasicDBObject();
    dBObject.put("hello", "world");
    collection.insert(dBObject);
    count = collection.count();
    log.info("Object count in test collection after insert:" + count);

    Result result = new Result();
    List<DBObject> dbObjects = new ArrayList<DBObject>();
    DBCursor cursor = collection.find();
    while (cursor.hasNext()) {
        com.mongodb.DBObject obj = cursor.next();
        final String value = (String) obj.get("hello");
        DBObject object = new DBObject();
        object.setKey("hello");
        object.setValue(value);
        dbObjects.add(object);
    }
    result.setDbObjects(dbObjects);
    result.setStatus(
            "Successfully accessed Mongodb service. Retrieving the data object inserted in test collection.");
    collection.drop();
    return result;
}
 
开发者ID:SAP,项目名称:hcp-cloud-foundry-tutorials,代码行数:31,代码来源:RootController.java

示例5: test1

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Test
public void test1() {
    IndexDefinition iDef = IndexDefinitionFactory.getDefinition("idField(id) string, fundField(fund) string, sideField(side) string");
    iDef.setIndexName("FOO");
    List<IndexDefinition> indexDefinitions = new ArrayList<IndexDefinition>();
    indexDefinitions.add(iDef);

    store.createIndexHandler(new IndexProducer(indexDefinitions));

    DBCollection collection = MongoDBFactory.getDB("Test").getCollection("strumpet_index_index");
    List<DBObject> indexes = collection.getIndexInfo();

    // we should have the number of indexes in the definition
    // (plus 2 that are always created: _id and key)
    // only test for indexes created by createRelatedTableStore() ...
    // assertEquals(5, indexes.size());

    ArrayList<String> index_names = new ArrayList<>(indexes.size());
    for (DBObject i: indexes) {
        index_names.add((String) i.get("name"));
    }

    //name should be one provided
    assertTrue(index_names.contains("FOO"));

    collection.drop();
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:28,代码来源:MongoIndexDefinitionTest.java

示例6: test2

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Test
public void test2() {
    IndexDefinition iDef1 = IndexDefinitionFactory.getDefinition("id1Field(id1) string");
    IndexDefinition iDef2 = IndexDefinitionFactory.getDefinition("fooField(foo) string, barField(bar) string");

    List<IndexDefinition> indexDefinitions = new ArrayList<IndexDefinition>();
    indexDefinitions.add(iDef1);
    indexDefinitions.add(iDef2);

    store.createIndexHandler(new IndexProducer(indexDefinitions));

    DBCollection collection = MongoDBFactory.getDB("Test").getCollection("strumpet_index_index");
    List<DBObject> indexes = collection.getIndexInfo();

    // we should have the number of indexes in the definition
    // (plus 2 that are always created: _id and key)
    // only test for indexes created by createRelatedTableStore() ...
    // assertEquals(5, indexes.size());

    ArrayList<String> index_names = new ArrayList<>(indexes.size());

    for (DBObject i: indexes) {
        index_names.add((String) i.get("name"));
    }

    assertTrue(index_names.contains("id1Field_idx"));
    assertTrue(index_names.contains("fooFieldbarField_idx"));

    collection.drop();
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:31,代码来源:MongoIndexDefinitionTest.java

示例7: removeQueue

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Override
public boolean removeQueue(String jobClientNodeGroup) {
    String tableName = JobQueueUtils.getFeedbackQueueName(jobClientNodeGroup);
    DBCollection dbCollection = template.getCollection(tableName);
    dbCollection.drop();
    LOGGER.info("drop queue " + tableName);
    return true;
}
 
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:9,代码来源:MongoJobFeedbackQueue.java

示例8: removeQueue

import com.mongodb.DBCollection; //导入方法依赖的package包/类
@Override
public boolean removeQueue(String taskTrackerNodeGroup) {
    String tableName = JobQueueUtils.getExecutableQueueName(taskTrackerNodeGroup);
    DBCollection dbCollection = template.getCollection(tableName);
    dbCollection.drop();
    LOGGER.info("drop queue " + tableName);

    return true;
}
 
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:10,代码来源:MongoExecutableJobQueue.java


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