liquibase-mongodb icon indicating copy to clipboard operation
liquibase-mongodb copied to clipboard

Inserts with JSON changelog doesn't work (MongoDB)

Open szandany opened this issue 3 years ago • 0 comments

Environment Liquibase 4.3.4 Liquibase-mongoDB extension 4.3.4 Linux/Windows JSON format changelog with insertOne/insertMany change types.

When testing the following changelog https://github.com/liquibase/liquibase-mongodb/blob/main/src/test/resources/liquibase/ext/json/generic-1-insert-people.json It appears that the insertOne change type passed successfully with the liquibase update. However, the data is missing or corrupted.

The insertMany change type appears to fail with the following stack trace:

Caused by: com.mongodb.MongoCommandException: Command failed with error 16 (InvalidLength): 'Write batch sizes must be between 1 and 100000. Got 0 operations.' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "Write batch sizes must be between 1 and 100000. Got 0 operations.", "code": 16, "codeName": "InvalidLength"}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:302)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:258)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:99)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:450)
at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:72)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:226)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:269)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:131)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:123)
at com.mongodb.operation.CommandOperationHelper.executeCommand(CommandOperationHelper.java:343)
at com.mongodb.operation.CommandOperationHelper.executeCommand(CommandOperationHelper.java:334)
at com.mongodb.operation.CommandOperationHelper.executeCommandWithConnection(CommandOperationHelper.java:220)
at com.mongodb.operation.CommandOperationHelper$5.call(CommandOperationHelper.java:206)
at com.mongodb.operation.OperationHelper.withReadConnectionSource(OperationHelper.java:463)
at com.mongodb.operation.CommandOperationHelper.executeCommand(CommandOperationHelper.java:203)
at com.mongodb.operation.CommandOperationHelper.executeCommand(CommandOperationHelper.java:198)
at com.mongodb.operation.CommandReadOperation.execute(CommandReadOperation.java:59)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:194)
at com.mongodb.client.internal.MongoDatabaseImpl.executeCommand(MongoDatabaseImpl.java:194)
at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:163)
at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:158)
at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:148)
at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:59)
at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:55)
at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.execute(AbstractRunCommandStatement.java:51)
at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.execute(AbstractRunCommandStatement.java:36)
at liquibase.nosql.executor.NoSqlExecutor.execute(NoSqlExecutor.java:181

┆Issue is synchronized with this Jira Bug by Unito

szandany avatar May 12 '21 13:05 szandany