Questions tagged [mongock]
Mongock is a java MongoDB tool for tracking, managing and applying database schema changes across all your environments based on a coding approach.
66
questions
0
votes
2
answers
44
views
Database Migration with Mongock and Spring Boot
I have a class
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document("animal")
public class Animal {
private String id;
private boolean isBirthYear;
}
I want to update class to:
@...
0
votes
1
answer
21
views
can't create an index with mongock on a mongodb collection
Each time I try to create an index on a collection with mongock I have this error:
Command createIndexes does not support this transaction's { readConcern: { level: "majority", provenance: &...
-1
votes
1
answer
34
views
Kotlin + Mongock for Spring Boot + Spring Data: IllegalAccessError
I have created a Kotlin application that connects to a MongoDB on Atlas to fetch some data via Spring Data JPA. For future changes to the document structure, I have experimented with Mongock. I have ...
0
votes
2
answers
95
views
MongoCK ChangeUnit doesn't auto wire other spring beans as dependency
How do I make the ChangeUnit work with other spring beans in my app? I've tried adding dependencies to the ChangeUnit via construction injection and setter injection, and using post construct to build ...
0
votes
1
answer
72
views
What to do when name of class and collection used in Mongock migration file has changed?
I have an app in Spring Boot and use Mogock with MongoDB. Recently, I made a big refactoring and changed many class names and collection names. What I used to have before refactoring is an entity ...
0
votes
1
answer
35
views
Mongock failing to log scripts w runAlways=true in mongockChangeLog collection
I currently have four ChangeUnits written as follows:
id="system-codes-initializer" (runAlways=true)
id="source-config-initializer" (runAlways=true)
id="action-box-...
0
votes
1
answer
72
views
Mongock "Wrong parameter [ClientSession]. Dependency not found" error
I'm trying to run the standalone-mongodb-sync example (https://github.com/mongock/mongock-examples/tree/master/mongodb) in the Mongock examples directory with mongodb-v3-driver. The only ...
0
votes
0
answers
32
views
Mongock support for JSON changelogs
I'd ideally like to specify my changelog in JSON format, similar to Liquibase's JSON option, as follows below. Notably, I'd also like to do a substitution for the Integer value of clusterId at runtime ...
0
votes
1
answer
79
views
Mongock support for executing changelogs with parameters?
I'm wondering whether Mongock has support for running a changelog multiple times with a list of parameters. My use case involves needing to insert multiple documents following the same template into ...
0
votes
1
answer
159
views
Mongock spring-boot delay bean creation until Mongock is done
With liquibase and Spring Boot I can do @DependsOn("liquibase") to wait when I have a @Bean creating method. This lets me create beans that depend on initialization data.
How do I do this in ...
0
votes
1
answer
21
views
How to calculate price for mongock professional? [closed]
can someone please explain how exactly pricing strategy for mongock professional works?
I can see on this webpage that price is "$20 / unit in production per month", but what is "unit&...
0
votes
1
answer
173
views
Does Mongock support Mongo version 2.x?
I have to execute migrations on the mongo server version: 2.6.10. I use mongock-springboot 5.2.4, spring boot version 2.7.2 and spring-data-mongodb version 3.4.2.
I don't think it's possible[1], but I'...
0
votes
1
answer
123
views
Mongock execute range of change-units in integration test
Question: How can I execute certain range of change-units in integration tests ?
Example of the problem: I have three change-units: X,Y,Z (with order set to: 1, 2, 3). I have integration tests T1 for ...
0
votes
1
answer
70
views
Repository for mongock-core 4.3.8
I try to update my mongock-core dependency to 4.3.8 (from 3.3.2) but it does not find the jar for the dependency.
So i have checked on the maven central repository i am using (https://repo1.maven....
1
vote
1
answer
2k
views
MongockException: Command failed with error 251 (NoSuchTransaction)
I am using Spring-Boot 3.0.4 and I have upgraded Mongock from 4.3.8 to 5.2.2.
pom.xml snipped
<dependencies>
<dependency>
<groupId>io.mongock</groupId>
<...
1
vote
1
answer
503
views
Mongock does not run changeunit in kotlin project
I have Java + maven project - https://github.com/petersuchy/mongock-test-java based on Mongock reactive example (https://github.com/mongock/mongock-examples/tree/master/mongodb/springboot-reactive)
...
3
votes
4
answers
2k
views
Could not found method getBuilder in io.mongock.runner.springboot.config.MongockContext required a bean of type 'ConnectionDriver'
I have a problem with proper configure mongock for my project.
I have added to pom.xml dependencies:
<dependencies>
<dependency>
<groupId>io.mongock</groupId>
...
0
votes
1
answer
146
views
mongock: @Execution vs @BeforeExecution
Where is I should define scheme validation rules using mongock as migration tool?
In official library examples it's placed in the @BeforeExecution section. Why?
0
votes
2
answers
246
views
MongoDb error: 'cannot use 'j' option when a host does not have journaling enabled'
I was using mongo in dev just fine, when deploying the app into test env I got this error:
com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'cannot use 'j' option when a host ...
0
votes
0
answers
115
views
MongockTemplate bean in integration test
how to autowired MongockTemplate in SpringBootTest?
MongockTemplate does not autowired in @SpringBootTest
I try:
full exception:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error ...
0
votes
1
answer
168
views
Caused by: java.lang.AbstractMethodError Method...MongockTemplate.updateMulti is abstract
I am using mongock, all migration correctly pass, bun when invoke mongoTemplate.updateMulti then throw an
Caused by: java.lang.AbstractMethodError: Method com/github/cloudyrock/mongock/driver/mongodb/...
0
votes
1
answer
240
views
How to implement @RollbackExecution method for Mongock
I have simple document class:
public class Player {
private String name;
private String age;
}
I want to extend it with field Parameters:
public class Player {
private String name;
...
0
votes
1
answer
170
views
how should migrate my DBRef fields with mongock?
I have a problem with migrating an entity which has DBRef fields. If I change any field in this entity, my DBRefs are gone. What should I do?
Query query = new Query();
List<Criteria> ...
0
votes
2
answers
925
views
Running Mongock on only one database in multidatabase Spring project
I have quite large legacy multi module Java Spring boot project which connects to one MySql database and two Mongo databases (lets say codebook and report).
I'm trying to setup Mongock to be able to ...
0
votes
1
answer
340
views
module does not opens unanmed module using quarkus and mongock
I get the following issue when starting up quarkus with mongock on java 17:
2022-07-22 07:50:57,109 ERROR [io.mon.run.cor.exe.MongockRunnerImpl] (main) Error in mongock process. ABORTED MIGRATION: io....
0
votes
1
answer
286
views
mongock @BeforeExecution is not executed
I need to initialize admin from env variables, but @BeforeExecution method is not launched, execution directly starts in initAdmin method. Any suggestions?
@ChangeUnit(id = "init", order = &...
0
votes
1
answer
266
views
Fail to start Mongock CLI with Spring Boot, NullPointerException: Cannot invoke buildRunner
I've tried using Mongock for DB migrations and it's a really good tool. It activates when main application is launched. Recently I found out that there is Mongock CLI, and it suits better for my aims. ...
1
vote
3
answers
518
views
field annotated with `@value` is not initialized in mongock configuration
I need to assure data migration using mongock.
The @ChangeUnit class holds the logic for migration. It has a field annotated with @Value which is always null, even though I properly initialized in ...
0
votes
1
answer
383
views
When extending the RepresentationModel<T> class of HATEOAS in the model using mongodb the application no longer works - spring boot
I'm studying spring building an API using spring-boot,mongodb,lombok, mongock... this
project.
When putting HATEOAS I had problems, I noticed that it was related the moment I inherit the ...
0
votes
0
answers
217
views
Using sprinboot convert existing document's inner object to an array
I have below structure in MongoDB :
{
"id" : "6c71-fea4-4bg6-a0bf-768n0n54t59",
"continents" : [
{
"id" : "45" ,
"countries&...
0
votes
1
answer
546
views
Can we use mongock as a migration tool to rename mongodb collection
We are going to rename a mongodb collection and writing migration script in our spring boot microservice.Is it ok to use mongock for the same?
Trying to understand if the changeunit is executed once ...
2
votes
1
answer
430
views
MongoDB: Search by field with date and update it by condition
Please tell me how can I fulfill the following condition - if the time in the info.startDate field is not equal to 00 hours, increase the date (2021-05-27) by 1 day ahead, set the time to 00:00:00....
0
votes
1
answer
734
views
Advice on resetting Mongock Changesets
We are using Mongock in our spring-boot/kotlin microservices as our main Mongo DB migration tool and it is working perfectly. We started with a simple json file to create a few collections and have ...
0
votes
1
answer
2k
views
How to test change unit in mongock with its multiple attributes/lifecycle methods?
We recently migrated from MongoBee to Mongock, and with Mongock 5 version the @ChangeLog and @ChangeSet are depricated. Writing the @ChangeUnit is easy enough and rollback methods are very helpful.
...
0
votes
0
answers
213
views
Mongock data partitioning
I am trying o migrate data in MongoDB with mongock and stumbled upon an issue when I need to run migration across a big amount of data.
Is there a way to partition this data in any way? I didn't find ...
0
votes
1
answer
1k
views
How to handle downgrade operation with Mongock?
I have a question about performing downgrade together with Mongock. I got Java Spring application integrated with mongock and let's suppose that I upgraded my application from v1 to v2. During the ...
0
votes
1
answer
432
views
MongoCK: How to import and migrate mongoDB data between different system versions on the fly?
I have 2 instances of Java server running in a docker along with the MongoDB database. We use mongock to migrate the MongoDB data which works fine. I have developed a feature where user can export ...
0
votes
1
answer
201
views
Launch Mongock faster so when changelog fails the application crashes before a heath check can pass
We recently added MongoCk to our Spring 5 app (using the Spring runner), but are having some issues during our deploys. Our final step in the deploy process is a health check where the deployment ...
1
vote
2
answers
1k
views
java mongo json schema validation
I would like to know if mongock supports synthax such as:
"allOf": [{ "$ref": "/schema/base" }]
when it build the validation during the collection creation or if you ...
0
votes
0
answers
68
views
Is there a way to use Regex to execute indexOps on Mongo?
I've some collections on my database that have a 'Dynamic Name',
Let's say that I've some collections that store Animals data from an specific country,
So in my database Animals I would have the ...
0
votes
1
answer
602
views
Best way to init database with specific data by environment (dev, pprod, prod) using Mongock
I'm using Mongock to init a MongoDb database with some configs, An array of authorized users by calling system. {systemId: 'a', authorizedUsers: ['user1', user2]}.
My problem come from the fact that ...
0
votes
2
answers
1k
views
Spring-Boot: how to check if Mongock has completed?
I'm using Mongock for migrating and initializing my MongoDB database with Spring-Boot.
What I need is a way to check when all the changelogs have been applied.
How can I check if Mongock completed all ...
0
votes
1
answer
779
views
Mongodb - updating a collection with >100,000 documents in migration
Following migration code seems to be getting stuck while updating this huge collection.
@ChangeSet(order = "010", id = "add_tenant_to_product", author = "pn")
fun ...
0
votes
1
answer
81
views
How to startup Hazelcast after Mongock migration?
With default configs Hazelcast run before Mongock. I use Hazelcast ITopic for prod/cons communications between microservices. But I receive data from the topic before the execution of the DB migration ...
0
votes
1
answer
1k
views
Mongock failed: NoClassDefFoundError org/springframework/data/mongodb/MongoDatabaseFactory
I'm using the following pom in my spring boot app:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
&...
1
vote
1
answer
3k
views
Mongock migration failure with transaction
I'm running a spring boot 2.4.3 app and I have a mongodb 4 cluster which supports transactions(I run it locally using run-rs). I'm also using spring data mongodb. I'm trying to integrate mongock(...
0
votes
2
answers
709
views
How do I decrease the time required for a mongock script to acquire a lock?
We are running our mongock scripts in Kubernetes. Our service pod has replicas, so on initialization the first replica acquires the mongock lock while the second (and third) replicas wait their turn. ...
0
votes
1
answer
270
views
How to disable throwExceptionIfCannotObtainLock in mongock
Used the traditional approach of running mongock -
https://www.mongock.io/quick-start#traditional-builder-approach
@Bean
public MongockSpring5.MongockInitializingBeanRunner changockSpring5(...
1
vote
1
answer
635
views
Mongock inserting duplicate changeset on runAlways=true
My application uses mongock 4.1.19 and when ever there is a changeSet with runAlways=true, there are duplicate entries getting created in the dbchangelog collection.
the below line does not seem to ...
0
votes
1
answer
160
views
When is Mongock undo expected
I am starting to use Mongock for mnongoDB migrations.
I was wondering when is the 'Undo' feature for Mongock may be expected? It is a very important feature
Thanks