public class DefaultMongoTemplate extends AuthenticatingMongoTemplate implements MongoTemplate
MongoTemplate. This implementation requires access to the configured Mongo object. You can influence the names of the collections used to store the events as well as the
snapshot events.| Constructor and Description |
|---|
DefaultMongoTemplate(com.mongodb.Mongo mongo)
Initializes the MongoTemplate using the given
mongoDb for database access, using default database
and collection names. |
DefaultMongoTemplate(com.mongodb.Mongo mongo,
String databaseName,
String domainEventsCollectionName,
String snapshotEventsCollectionName,
String userName,
char[] password)
Creates a template connecting to given
mongo instance, and loads events in the collection with
given domainEventsCollectionName and snapshot events from snapshotEventsCollectionName,
in a database with given databaseName. |
DefaultMongoTemplate(com.mongodb.Mongo mongo,
String databaseName,
String domainEventsCollectionName,
String snapshotEventsCollectionName,
String authenticationDatabase,
String userName,
char[] password)
Creates a template connecting to given
mongo instance, and loads events in the collection with
given domainEventsCollectionName and snapshot events from snapshotEventsCollectionName,
in a database with given databaseName. |
| Modifier and Type | Method and Description |
|---|---|
com.mongodb.DBCollection |
domainEventCollection()
Returns a reference to the collection containing the domain events.
|
com.mongodb.DBCollection |
snapshotEventCollection()
Returns a reference to the collection containing the snapshot events.
|
databasepublic DefaultMongoTemplate(com.mongodb.Mongo mongo)
mongoDb for database access, using default database
and collection names.
Database name: DefaultMongoTemplate(com.mongodb.Mongo, String, String, String, String, char[]) to
provide different names for database and/or collections.mongo - The actual connection to a MongoDB instancepublic DefaultMongoTemplate(com.mongodb.Mongo mongo,
String databaseName,
String domainEventsCollectionName,
String snapshotEventsCollectionName,
String userName,
char[] password)
mongo instance, and loads events in the collection with
given domainEventsCollectionName and snapshot events from snapshotEventsCollectionName,
in a database with given databaseName. When not null, the given userName
and password are used to authenticate against the database.mongo - The Mongo instance configured to connect to the Mongo ServerdatabaseName - The name of the database containing the datadomainEventsCollectionName - The name of the collection containing domain eventssnapshotEventsCollectionName - The name of the collection containing snapshot eventsuserName - The username to authenticate with. Use null to skip
authenticationpassword - The password to authenticate with. Use null to skip
authenticationpublic DefaultMongoTemplate(com.mongodb.Mongo mongo,
String databaseName,
String domainEventsCollectionName,
String snapshotEventsCollectionName,
String authenticationDatabase,
String userName,
char[] password)
mongo instance, and loads events in the collection with
given domainEventsCollectionName and snapshot events from snapshotEventsCollectionName,
in a database with given databaseName. When not null, the given userName
and password are used to authenticate against the database.mongo - The Mongo instance configured to connect to the Mongo ServerdatabaseName - The name of the database containing the datadomainEventsCollectionName - The name of the collection containing domain eventssnapshotEventsCollectionName - The name of the collection containing snapshot eventsauthenticationDatabase - The name of the database to authenticate touserName - The username to authenticate with. Use null to skip
authenticationpassword - The password to authenticate with. Use null to skip
authenticationpublic com.mongodb.DBCollection domainEventCollection()
domainEventCollection in interface MongoTemplatepublic com.mongodb.DBCollection snapshotEventCollection()
snapshotEventCollection in interface MongoTemplateCopyright © 2010-2014. All Rights Reserved.