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
FieldsModifier and TypeFieldDescriptionprotected final org.bson.Documentstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface liquibase.statement.SqlStatement
EMPTY_SQL_STATEMENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckResponse(org.bson.Document responseDocument) Inspects response Document for any issues.voidexecute(MongoLiquibaseDatabase database) abstract StringReturns the RunCommand command name.org.bson.Documentrun(com.mongodb.client.MongoDatabase mongoDatabase) org.bson.Documentrun(MongoLiquibaseDatabase database) toJs()Methods inherited from class liquibase.nosql.statement.AbstractNoSqlStatement
continueOnError, skipOnUnsupported, toStringMethods inherited from class liquibase.statement.AbstractSqlStatement
setContinueOnError
-
Field Details
-
COMMAND_NAME
- See Also:
-
SHELL_DB_PREFIX
- See Also:
-
OK
- See Also:
-
WRITE_ERRORS
- See Also:
-
command
protected final org.bson.Document command
-
-
Constructor Details
-
AbstractRunCommandStatement
public AbstractRunCommandStatement()
-
-
Method Details
-
execute
- Specified by:
executein interfaceNoSqlExecuteStatement<MongoLiquibaseDatabase>
-
run
-
run
public org.bson.Document run(com.mongodb.client.MongoDatabase mongoDatabase) -
checkResponse
protected void checkResponse(org.bson.Document responseDocument) throws com.mongodb.MongoException Inspects 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
- Insert Output
-
getCommandName
- Specified by:
getCommandNamein classAbstractNoSqlStatement
-
getRunCommandName
Returns the RunCommand command name.- Returns:
- the run command as this is not used and not required for a generic RunCommandStatement
- See Also:
-
toJs
- Overrides:
toJsin classAbstractMongoStatement
-