Liquibase maven plugin with MongoDb

Hello,

I am trying to use liquibase-mongodb extension with Liquibase-maven -plugin
following are the versions i am using :
<liquibase-core.version>4.23.0</liquibase-core.version>
<liquibase-maven-plugin.version>4.23.0</liquibase-maven-plugin.version>
<liquibase-mongodb.version>4.23.0</liquibase-mongodb.version>

Below is my property file:
changeLogFile=src/main/resources/db/master.xml
url=mongodb://Insight.com:2052/web_db?authSource=web_db
username=user
password:password
driver=liquibase.ext.mongodb.database.MongoClientDriver

But when i try to execute using : mvn clean install it gives my this error:
[ERROR] Error setting up or running Liquibase:
[ERROR] liquibase.exception.LockException: liquibase.exception.DatabaseException: Could not execute: Command failed with error 13 (Unauthorized): 'not authorized on web_db to execute command

I am sure the user i am using has read and write both permissions, i am able to login with that user and execute all sort of DDL and DML. but its not working from liquibase.

Can someone please help ?
am i using the correct configurations?

any update @ronak @MikeOlivas

@Pooja you might try checking these roles are setup properly in your environment.

amazing. it works @MikeOlivas thank you very. much for yorur help

Now that i have permissions set up correctly, i am trying to connect fine.
and able to execute changesets in liquibase SQL format as well.
but there is a demand in our project to use js files rather that liquibase SQL format.
so when i am trying to include js file i see following error :slight_smile: Reason: java.lang.IllegalArgumentException: Mongodb cannot execute liquibase.statement.core.RawSqlStatement statements





and js file looks like…

var permissions = [
{
“permissionid” : NumberInt(501272), // Enable menu for connect
“levelid” : NumberInt(0)
}
];
var wIds = [861540480,861440039];

db.webgroup.update({_id: {$in : wIds }},{$set: {“permissions” : permissions, “isWebGroupCesEnabled” : true, “updatedon”: new Date(), “updatedby” : “CES Migration” }},{multi:true});

var rId = db.roles.findOne({name:“CES User”, “type”:“PRESET” },{_id:1})[“_id”];

db.users.find({“webgroups.webgroupid”: {$in :wIds },status: “Active”}).forEach(function(d) {

d.webgroups.forEach(function(w) {
if( wIds.indexOf(w.webgroupid) > -1){
d.preference.homepageid = NumberInt(1);
}
});

db.users.save(d);
});

do i need to change liquibase version?
i am using 4.20.0 now…of both liquibase-mongodb and liquibase-maven-plugin

this is my changeset

@MikeOlivas do u know this issue?

ok so @MikeOlivas i have been reading about the mongodb extension.
it appears its available only to the paid liquibase users which we are not as of this year.
so we cant implement liquibase in mongodb because developers in our team would like to stick to js script for writing mongo queries.

@Pooja That is correct. If developers want to use .js files, they would need the paid version.

Ok thanks for your response Mike.!