Package com.mongodb

Examples of com.mongodb.DB.dropDatabase()


        final IniMongoProperties properties = new IniMongoProperties();
        final String uri = properties.get("mongodb.uri", String.class).or("mongodb://localhost:27017/");
        final String database = properties.get("mongodb.database", String.class).or("geogig");
        MongoClient client = new MongoClient(new MongoClientURI(uri));
        DB db = client.getDB(database);
        db.dropDatabase();

        MongoConnectionManager manager = new MongoConnectionManager();
        ConfigDatabase config = new TestConfigDatabase(platform);
        MongoGraphDatabase mongoGraphDatabase = new MongoGraphDatabase(manager, config);
        return mongoGraphDatabase;
View Full Code Here


        while (cursor.hasNext()) {
            System.out.println(cursor.next());
        }

        // clean up
        db.dropDatabase();
        mongoClient.close();
    }
}
View Full Code Here

                System.out.println(pCursor.next());
            }
        }

        // release resources
        db.dropDatabase();
        mongoClient.close();
    }
    // CHECKSTYLE:ON
}
View Full Code Here

                if (!db.isAccessible())
                {
                    db.setAccessible(true);
                }
                DB mongoDB = (DB) db.get(client);
                mongoDB.dropDatabase();
            }
            catch (SecurityException e)
            {
                logger.error("Error while truncating db",e);
            }
View Full Code Here

                if (!db.isAccessible())
                {
                    db.setAccessible(true);
                }
                DB mongoDB = (DB) db.get(client);
                mongoDB.dropDatabase();
            }
            catch (SecurityException e)
            {
                logger.error("Error while truncating db",e);
            }
View Full Code Here

                if (!db.isAccessible())
                {
                    db.setAccessible(true);
                }
                DB mongoDB = (DB) db.get(client);
                mongoDB.dropDatabase();
            }
            catch (SecurityException e)
            {
                logger.error("Error while truncating database", e);
            }
View Full Code Here

        url += "/" + dbname;

        Mongo mongo = new Mongo(new DBAddress(url));

        DB db = mongo.getDB(dbname);
        db.dropDatabase();
        mongo.close();
    }

    /**
     * Start Mongo server.
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.