Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community

    Exciting times! πŸŽ‰

    We have now a Gitter community to chat about All Mongock things πŸ₯³

    Some useful links:

    Happy chatting! πŸ€–

    Ana Cutillas
    Hi! First question ever? Well, here I go. We have recently updated our mongodb version from 4.2 to 5, we're also updating dependencies and I'm trying to go from mongock 4.3 to 5. I added the new dependencies with the new groupId. But since we have ChangeLog and ChangeSet, should I also keep the old dependency with the old groupId? Or is it included in the new one? I tried changing import com.github.cloudyrock.mongock.ChangeLog for import io.mongock.ChangeLog but that didn't work.
    9 replies
    Tim Michalski

    I have a situation in my Spring Boot app where I need to create default users within the MongoDB database, but I have to then invoke an external call to register the user in a cloud-based Authentication server. The call to the external Authentication server fails with an error when it makes the outbound call. I'm guessing that perhaps the ApplicationContext is not fully started and available for fully application functionality?

    When I attempt to debug the code, my injected class "AuthenticationServer" doesn't even get executed when I call "authenticationServer.register(user)" and place a breakpoint within this method. This is leading me to believe that the Spring context isn't ready or something is up with the Change Unit logic?

    3 replies
    Oliver Santana
    Thanks Tim, could you give us more details about the error you get? Or just your method is not executing, without any error?
    9 replies
    Oliver Santana

    Hi Tim! Mongock creates a proxy for every injected dependency in the ChangeUnit’s methods as parameters. The proxy is a mechanism to ensure Mongock has the lock acquired. If you annotate the param with @NonLockGuarded you are preventing Mongock to create a proxy for it. In your case, you can omit proxy for that service, because this SSO authentication doesn't required synchronisation. This synchronisation is critical specially for DB writes.

    Said that, that proxy only ensures the lock is acquired in every i/o method call. There is a daemon in charge of acquiring and maintaining the lock. So realistically speaking , even that SSO call is also synchronised.

    1 reply
    Hello! Tried to build examples https://github.com/mongock/mongock-examples TenantManager in MultiTenantMongoAppConfig is not available.
    1 reply

    Hello, we are trying mongock examples provided in https://github.com/mongock/mongock-examples. When we build "jar" for "springboot-quickstart" example and then, run with mongock CLI, we get the following exception:

    io.mongock.api.exception.MongockException: Operation 'MIGRATION' not found. It may be a professional operation and the professional library is not provided
    at io.mongock.runner.core.executor.ExecutorBuilderDefault.getExecutorByOperation(ExecutorBuilderDefault.java:22)
    at io.mongock.runner.core.executor.ExecutorBuilderBase.buildExecutor(ExecutorBuilderBase.java:69)
    at io.mongock.runner.core.builder.RunnerBuilderBase.buildExecutor(RunnerBuilderBase.java:248)
    at io.mongock.runner.core.builder.RunnerBuilderBase.buildRunner(RunnerBuilderBase.java:143)
    at io.mongock.runner.core.builder.RunnerBuilderBase.buildRunner(RunnerBuilderBase.java:129)
    at io.mongock.cli.core.commands.migrate.MigrateCommand.call(MigrateCommand.java:27)
    at io.mongock.cli.core.commands.migrate.MigrateCommand.call(MigrateCommand.java:13)

    Could you help me with this topic? Is there a licensed version or are all the features open source?.
    Thanks you!

    4 replies

    Hello, I would like to perform undo operation (./mongock undo all) on the provided example (standalone-springdata) but I get the following error:

    picocli.CommandLine$ExecutionException: Error while calling command (public java.lang.Integer io.mongock.cli.core.commands.undo.UndoCommand.all()): java.lang.NoClassDefFoundError: io/mongock/professional/runner/common/executor/operation/undo/UndoAllOperation
    at picocli.CommandLine.executeUserObject(CommandLine.java:1986)
    at picocli.CommandLine.access$1300(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
    at picocli.CommandLine.execute(CommandLine.java:2078)
    at io.mongock.cli.core.CommandLineDecorator.execute(CommandLineDecorator.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at io.mongock.cli.wrapper.launcher.LauncherStandalone.executeCli(LauncherStandalone.java:94)
    at io.mongock.cli.wrapper.launcher.LauncherStandalone.launch(LauncherStandalone.java:71)
    at io.mongock.cli.wrapper.MongockCli.main(MongockCli.java:52)
    Caused by: java.lang.NoClassDefFoundError: io/mongock/professional/runner/common/executor/operation/undo/UndoAllOperation
    at io.mongock.cli.core.commands.undo.UndoCommand.all(UndoCommand.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1972)
    ... 14 more
    Caused by: java.lang.ClassNotFoundException: io.mongock.professional.runner.common.executor.operation.undo.UndoAllOperation
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:814)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 20 more
    Could you give me some hints? is it due to the missing PRO version? How can I get it?
    (Normal migration operations works properly)

    7 replies

    πŸ“£ New Release: Mongock Professional πŸŽ‰

    We are pleased to announce the release of our new Professional version! This includes:
    • Undo operation to move to a previous version
    • More supported operations via the CLI
    • Multitenancy deployment
      And many more! Try it out from https://mongock.io/professional. Happy migrating!
    Robert Wenig
    Any plans to integrate ArangoDB?
    3 replies
    Hi Team, I'm trying to move legacy mongobee to mongock referred https://docs.mongock.io/v5/features/legacy-migration/index.html. during first time of deploying or performing the migration step with mongock, will it try to execute the migration on db or it just moving the data from dbchangelog to mongockChangeLog ? example if i had changeset to drop and contraint to a collection, will it try to perform this step again now, as it was already performed with mongobee migration.
    3 replies
    Yadhukrishna S Pai

    Hi, I was looking at changes for mongock/mongock#508, I noticed that we had a lot of methods which have param of Class<?> changeUnitClass in AnnotationProcessor.class which need not be there and are useful in other part of code as well. For example, I have to make changes to ChangeLogRuntimeImpl.getConstructor which again will need to repeat logic which is somewhat already there in AnnotationProcessor

    I propose to create a new domain object, something like ChangeUnitClassDO which has a field of Class<?> changeUnitClass
    So, any method that needs to do something to or on a changeUnitClass, can do for example
    changeUnitClassDO.getBeforeMethod(), changeUnitClassDO.findMethodByAnnotation(RollbackBeforeExecution.class)etc

    What do you guys think?

    13 replies