Package com.mongodb

Examples of com.mongodb.DBCollection.drop()


        DB db = mongoClient.getDB(uri.getDatabase() != null
                                  ? uri.getDatabase()
                                  : "test");

        final DBCollection collection = db.getCollection("test");
        collection.drop();

        ExecutorService executorService = Executors.newFixedThreadPool(NUM_THREADS);

        for (int i = 0; i < NUM_THREADS; i++) {
            executorService.submit(new Runnable() {
View Full Code Here


        // get a collection object to work with
        DBCollection coll = db.getCollection("testCollection");

        // drop all the data in it
        coll.drop();

        // make a document and insert it
        BasicDBObject doc = new BasicDBObject("name", "MongoDB")
                .append("type", "database")
                .append("count", 1)
View Full Code Here

        validate(size, expect, forbid);
    }

    static void dropCollection(final String coll) throws Exception {
        final DBCollection collection = db.getCollection(coll);
        collection.drop();
    }

    static void addTestData(final String dataResource, final String mongoCollection, final int minSizeIfExists) throws Exception {
        final DBCollection collection = db.getCollection(mongoCollection);
        if (collection.find().count() >= minSizeIfExists) {
View Full Code Here

    }

    private void turnOffProfilingAndDropProfileCollection() {
        getDb().command(new BasicDBObject("profile", 0));
        DBCollection profileCollection = getDb().getCollection("system.profile");
        profileCollection.drop();
    }
}
View Full Code Here

   *            集合名称
   */

  public void drop(String collName) {
    DBCollection coll = db.getCollection(collName);
    coll.drop();
  }

  /**
   * 移除一个集合
   *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.