I’m a newbie. I’m trying to connect Liquibase with MongoDB in Spring Boot but getting some errors. I tried searching on google but had no success
Versions I’ve used
java: 17
liquibase-mongodb: 4.15.0
liquibase-core: 4.15.0
mongodb-jdbc: 2.0.0
mongo-java-driver: 3.12.11
spring-boot-starter-jdbc: 2.7.3
spring-boot-starter: 2.7.2
My config in application.properties file (I have disabled security in MongoDB)
# mongo config
spring.datasource.driver-class-name=com.mongodb.jdbc.MongoDriver
spring.datasource.url=mongodb://localhost:27017/BuildingQueryService
# liquibase config
spring.liquibase.enabled=true
spring.liquibase.driver-class-name=liquibase.ext.mongodb.database.MongoClientDriver
spring.liquibase.change-log=classpath:database/changelog/changelog_master.xml
spring.liquibase.url=mongodb://localhost:27017/BuildingQueryService
My change log file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="1" author="loic">
<ext:createCollection collectionName="Fruit"/>
<ext:createIndex collectionName="Fruit">
<ext:keys>{color: 1}</ext:keys>
<ext:options>{name: "colorIdx"}</ext:options>
</ext:createIndex>
<ext:insertOne collectionName="Fruit">
<ext:document>{"name":"orange", "color": "orange"}</ext:document>
</ext:insertOne>
</changeSet>
</databaseChangeLog>
My error
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: Cannot initiate a SQL Connection for a NoSql DB
Can someone help me? Thanks a lot!