- Introduction
- Release Notes
- Implemented Changes
- Getting Started
- Running tests
- Integration
- Contributing
- License
This is a Liquibase extension for MongoDB support.
It resulted as an alternative to existing MongoDB evolution tools.
Majority of them are basically wrappers over db.eval
shell method that is deprecated staring from MongoDB 4.2.
In order to call specific mongo-java-driver
specific methods,
Liquibase turned to be the most feasible tool to extend as it allows to define change sets to fit driver methods arguments.
- Fixed Does it support preconditions
- Added documentExistsPrecondition
- Support for Liquibase 4.2.2
- Support for Liquibase 4.2.1
- Fixed Rollback doesn't work with liquibase-mongodb-4.0.0.2 extension
- Added dropCollection and dropIndex Changes
- Added NoSql JSON Parser which can pass raw JSON for a property like this:
{
"options" :
{
"$rawJson" : { ... }
}
}
For the command line is required to copy to [liquibase]/lib
libraries : jackson-annotations-2.11.3.jar, jackson-core-2.11.3.jar, jackson-databind-2.11.3.jar
- New properties added
# If disabled can be used on API which do not support validators (Azure Cosmos DB with Mongo API, Amazon DocumentDB)
liquibase.mongodb.supportsValidator=true
# If enabled will adjust indexes and validators for Liquibase tracking tables LOCK and CHANGELOG. Can be disabled if sure Liquibase not updated.
liquibase.mongodb.adjustTrackingTablesOnStartup=true
- Overridden Liquibase table names removed. Now will be used the default ones in Liquibase. If previous releases used then table names should be explicitly passed as parameters.
Currently, by default as Liquibase default :
DATABASECHANGELOGLOCK, DATABASECHANGELOG
Previous releases used by default :databaseChangeLogLock, databaseChangeLog
- Support for Liquibase 4.1.1
- Support for Liquibase 4.1.0
- Works with Liquibase v4.0.0
- Support for Liquibase 3.10
- First release
A couple of Changes were implemented until identified that majority of the operations can be achieved using db.runCommand()
and db.adminCommand()
- createCollection - Creates a collection with validator
- dropCollection - Removes a collection or view from the database
- createIndex - Creates an index for a collection
- dropIndex - Drops index for a collection by keys
- insertMany - Inserts multiple documents into a collection
- insertOne - Inserts a Single Document into a collection
- runCommand - Provides a helper to run specified database commands. This is the preferred method to issue database commands, as it provides a consistent interface between the shell and drivers
- adminCommand - Provides a helper to run specified database commands against the admin database
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
mongo-java-driver:3.12.7
- Clone the project
- Run tests
Connection url can be adjusted here: url
Connection String Format
Run Integration tests by enabling run-its
profile
mvn clean install -Prun-its
Quick start Application for NoSql liquibase extensions
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-mongodb</artifactId>
<version>${liquibase-mongodb.version}</version>
</dependency>
public class Application {
public static void main(String[] args) {
MongoLiquibaseDatabase database = (MongoLiquibaseDatabase) DatabaseFactory.getInstance().openDatabase(url, null, null, null, null);
Liquibase liquibase = new Liquibase("liquibase/ext/changelog.generic.test.xml", new ClassLoaderResourceAccessor(), database);
liquibase.update("");
}
}
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the Apache License Version 2.0 - see the LICENSE.md file for details