Package liquibase.ext.mongodb.statement
Class AbstractRunCommandStatement
- java.lang.Object
-
- liquibase.statement.AbstractSqlStatement
-
- liquibase.nosql.statement.AbstractNoSqlStatement
-
- liquibase.ext.mongodb.statement.AbstractMongoStatement
-
- liquibase.ext.mongodb.statement.AbstractRunCommandStatement
-
- All Implemented Interfaces:
NoSqlExecuteStatement<MongoLiquibaseDatabase>,liquibase.statement.SqlStatement
- Direct Known Subclasses:
CreateCollectionStatement,CreateIndexStatement,DropCollectionStatement,DropIndexStatement,FindOneAndUpdateStatement,InsertManyStatement,ListCollectionNamesStatement,RunCommandStatement
public abstract class AbstractRunCommandStatement extends AbstractMongoStatement implements NoSqlExecuteStatement<MongoLiquibaseDatabase>
-
-
Field Summary
Fields Modifier and Type Field Description protected org.bson.Documentcommandstatic StringCOMMAND_NAMEstatic StringOKstatic StringSHELL_DB_PREFIXstatic StringWRITE_ERRORS
-
Constructor Summary
Constructors Constructor Description AbstractRunCommandStatement()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckResponse(org.bson.Document responseDocument)Inspects response Document for any issues.voidexecute(MongoLiquibaseDatabase database)StringgetCommandName()abstract StringgetRunCommandName()Returns the RunCommand command name.org.bson.Documentrun(com.mongodb.client.MongoDatabase mongoDatabase)org.bson.Documentrun(MongoLiquibaseDatabase database)StringtoJs()-
Methods inherited from class liquibase.nosql.statement.AbstractNoSqlStatement
continueOnError, skipOnUnsupported, toString
-
-
-
-
Field Detail
-
COMMAND_NAME
public static final String COMMAND_NAME
- See Also:
- Constant Field Values
-
SHELL_DB_PREFIX
public static final String SHELL_DB_PREFIX
- See Also:
- Constant Field Values
-
OK
public static final String OK
- See Also:
- Constant Field Values
-
WRITE_ERRORS
public static final String WRITE_ERRORS
- See Also:
- Constant Field Values
-
command
protected final org.bson.Document command
-
-
Method Detail
-
execute
public void execute(MongoLiquibaseDatabase database)
- Specified by:
executein interfaceNoSqlExecuteStatement<MongoLiquibaseDatabase>
-
run
public org.bson.Document run(MongoLiquibaseDatabase database)
-
run
public org.bson.Document run(com.mongodb.client.MongoDatabase mongoDatabase)
-
checkResponse
protected void checkResponse(org.bson.Document responseDocument) throws com.mongodb.MongoExceptionInspects response Document for any issues. For example the server responds with { "ok" : 1 } (success) even when run command fails to insert the document. The contents of the response is checked to see if the document was actually inserted For more information see the manual page- Parameters:
responseDocument- the response document- Throws:
com.mongodb.MongoException- a MongoException to be thrown- See Also:
- Insert Output
Check the response and throw an appropriate exception if the command was not successful
-
getCommandName
public String getCommandName()
- Specified by:
getCommandNamein classAbstractNoSqlStatement
-
getRunCommandName
public abstract String getRunCommandName()
Returns the RunCommand command name.- Returns:
- the run command as this is not used and not required for a generic RunCommandStatement
- See Also:
- Database Commands
-
toJs
public String toJs()
- Overrides:
toJsin classAbstractMongoStatement
-
-