public class MongoDBConnectionHelper extends Object
Modifier and Type | Method and Description |
---|---|
static com.mongodb.client.MongoDatabase |
getDatabase(com.mongodb.MongoClient mongoClient,
String dbname) |
static boolean |
hasCollection(com.mongodb.client.MongoDatabase mongoDatabase,
String collection)
Check if the collection exists and if it is not empty
|
static com.mongodb.MongoClient |
newMongoClient(String server)
Initialize a connection to the MongoDB server
|
public static com.mongodb.MongoClient newMongoClient(String server)
server
- the server urlpublic static com.mongodb.client.MongoDatabase getDatabase(com.mongodb.MongoClient mongoClient, String dbname)
public static boolean hasCollection(com.mongodb.client.MongoDatabase mongoDatabase, String collection)
mongoDatabase
- the Mongo databasecollection
- the collection nameCopyright © 2018 Nuxeo. All rights reserved.