public class Mongobee extends Object implements org.springframework.beans.factory.InitializingBean
| Constructor and Description |
|---|
Mongobee()
Simple constructor with default configuration of host (localhost) and port (27017).
|
Mongobee(com.mongodb.Mongo mongo)
Constructor takes db.mongodb.Mongo object as a parameter.
|
Mongobee(com.mongodb.MongoClientURI mongoClientURI)
Constructor takes db.mongodb.MongoClientURI object as a parameter.
|
Mongobee(String mongoURI)
Mongobee runner.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
For Spring users: executing mongobee after bean is created in the Spring context
|
void |
execute()
Executing migration
|
boolean |
isEnabled() |
Mongobee |
setChangeLogsScanPackage(String changeLogsScanPackage)
Package name where @ChangeLog-annotated classes are kept.
|
Mongobee |
setDbName(String dbName)
Used DB name should be set here or via MongoDB URI (in a constructor)
|
Mongobee |
setEnabled(boolean enabled)
Feature which enables/disables Mongobee runner execution
|
Mongobee |
setMongoClientURI(com.mongodb.MongoClientURI mongoClientURI)
Sets uri to MongoDB
|
Mongobee |
setSpringEnvironment(org.springframework.core.env.Environment environment)
Set Environment object for Spring Profiles (@Profile) integration
|
public Mongobee()
Simple constructor with default configuration of host (localhost) and port (27017). Although
the database name need to be provided using setDbName(String) setter.
It is recommended to use constructors with MongoURI
public Mongobee(com.mongodb.MongoClientURI mongoClientURI)
Constructor takes db.mongodb.MongoClientURI object as a parameter.
For more details about MongoClientURI please see com.mongodb.MongoClientURI docs
mongoClientURI - uri to your dbMongoClientURIpublic Mongobee(com.mongodb.Mongo mongo)
Constructor takes db.mongodb.Mongo object as a parameter.
For more details about Mongo please see com.mongodb.Mongo docs
mongo - database connectionMongopublic Mongobee(String mongoURI)
Mongobee runner. Correct MongoDB URI should be provided.
The format of the URI is:
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database[.collection]][?options]]
mongodb:// Required prefixusername:password@ are optional. If given, the driver will attempt to login to a database after
connecting to a database server. For some authentication mechanisms, only the username is specified and the password is not,
in which case the ":" after the username is left off as well.host1 Required. It identifies a server address to connect to. More than one host can be provided.:portX is optional and defaults to :27017 if not provided./database the name of the database to login to and thus is only relevant if the
username:password@ syntax is used. If not specified the "admin" database will be used by default.
Mongobee will operate on the database provided here or on the database overriden by setter setDbName(String).
?options are connection options. For list of options please see com.mongodb.MongoClientURI docsFor details, please see com.mongodb.MongoClientURI
mongoURI - with correct formatMongoClientURIpublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanException - exceptionpublic void execute()
throws MongobeeException
MongobeeException - exceptionpublic Mongobee setDbName(String dbName)
dbName - database namepublic Mongobee setMongoClientURI(com.mongodb.MongoClientURI mongoClientURI)
mongoClientURI - object with defined mongo uripublic Mongobee setChangeLogsScanPackage(String changeLogsScanPackage)
changeLogsScanPackage - package where your changelogs arepublic boolean isEnabled()
public Mongobee setEnabled(boolean enabled)
enabled - MOngobee will run only if this option is set to truepublic Mongobee setSpringEnvironment(org.springframework.core.env.Environment environment)
environment - org.springframework.core.env.Environment object to injectCopyright © 2014. All rights reserved.