public class Fongo extends Object
This class doesn't implement Mongo, but does provide the same basic interface
Usage:
Fongo fongo = new Fongo("test server");
com.mongodb.DB db = fongo.getDB("mydb");
// if you need an instance of com.mongodb.Mongo
com.mongodb.MongoClient mongo = fongo.getMongo();
| Modifier and Type | Method and Description |
|---|---|
void |
dropDatabase(String dbName)
Drop db and all data from memory
|
List<String> |
getDatabaseNames()
Get database names that have been used
|
com.mongodb.FongoDB |
getDB(String dbname)
equivalent to getDB in driver
multiple calls to this method return the same DB instance
|
com.mongodb.MongoClient |
getMongo()
A mocked out instance of com.mongodb.Mongo
All methods calls are intercepted and execute associated Fongo method
|
com.mongodb.ServerAddress |
getServerAddress()
This will always be localhost:27017
|
Collection<com.mongodb.DB> |
getUsedDatabases()
Get databases that have been used
|
com.mongodb.WriteConcern |
getWriteConcern() |
String |
toString() |
public Fongo(String name)
name - Used only for a nice toString in case you have multiple instancespublic com.mongodb.FongoDB getDB(String dbname)
dbname - name of the db.public Collection<com.mongodb.DB> getUsedDatabases()
public List<String> getDatabaseNames()
public void dropDatabase(String dbName)
dbName - name of the database.public com.mongodb.ServerAddress getServerAddress()
public com.mongodb.MongoClient getMongo()
public com.mongodb.WriteConcern getWriteConcern()
Copyright © 2016. All rights reserved.