Package com.ebasetech.xi.services
Class MongoServices
java.lang.Object
com.ebasetech.xi.services.MongoServices
- All Implemented Interfaces:
java.io.Serializable
public class MongoServices
extends java.lang.Object
implements java.io.Serializable
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description MongoServices()
-
Method Summary
Modifier and Type Method Description com.mongodb.MongoClient
getClient(java.lang.String databaseConnectionName)
Returns an instance of MongoClient representing a connection to the MongoDB database.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MongoServices
public MongoServices()
-
-
Method Details
-
getClient
public com.mongodb.MongoClient getClient(java.lang.String databaseConnectionName)Returns an instance of MongoClient representing a connection to the MongoDB database. Only one client instance is maintained and this is shared by all users.Javascript example:
var client = services.database.mongo.getClient("MongoDB"); var database = mongoClient.getDatabase("restaurants"); var collection = database.getCollection("restaurant");
- Parameters:
databaseConnectionName
- the name of the Database Connection as configured in the Server Administration Application- Returns:
- mongoDB client
- Throws:
com.ebasetech.xi.exceptions.FormRuntimeException
- if the connection cannot be obtained for any reason- Since:
- V5.3
-