Comments (6)
Could not reproduce. Could you please paste the json content as I cannot see the changeSet 1 applied in the logs? Suppose it was redacted. And it looks it failed at insertOne change.
from liquibase-mongodb.
Here is the changeLog
{ "databaseChangeLog": [ { "changeSet": { "id": "1", "author": "Alex", "comment": "Create person collection", "changes": [ { "createCollection": { "collectionName": "person", "options": { "$rawJson": { "validator": { "$jsonSchema": { "bsonType": "object", "required": [ "name", "address" ], "properties": { "name": { "bsonType": "string", "description": "The Name" }, "address": { "bsonType": ["string", "null"], "description": "The Address. Can accept nulls." }, "age": { "bsonType": "int", "description": "The Age" } } } }, "validationAction": "error", "validationLevel": "strict" } } } } ] } }, { "changeSet": { "id": "2", "author": "Nick", "comment": "Populate person table", "changes": [ { "insertOne": { "collectionName": "person", "document": { "$rawJson": { "name": "Alexandru Slobodcicov", "address": "Moldova" } } } }, { "insertMany": { "collectionName": "person", "documents": { "$rawJson": [ { "name": "Nicolas Bodros", "address": "Spain", "age": 34 }, { "name": "Luka Modrich", "address": null, "age": 55 } ] } } } ] } } ] }
The part it failed on is the insertMany change type.
...
"insertMany": { "collectionName": "person", "documents": { "$rawJson": [ { "name": "Nicolas Bodros", "address": "Spain", "age": 34 }, { "name": "Luka Modrich", "address": null, "age": 55 } ] } } }
...
from liquibase-mongodb.
Hi @szandany
Yes, indeed it fails at insertMany with java.lang.IllegalArgumentException: state should be: writes is not an empty list
It is because we got a insertOne, insertMany with empty document and respective documents fields.
insertOne passed as it can insert an empty document, insertMany couldn't because is not allowed to insert an empty Array of Document.
Could reproduce the same by misusing the $rawJson marker for example using the old marker $jsonPayload instead.
This could mean that you are using previous version of JsonNoSqlChangeLogParser which is still looking for $jsonPayload marker. you can confirm this by replacing $rawJson with $jsonPayload in your json example provided.
Please make sure you built the latest from main branch and have it in liquibase class path
from liquibase-mongodb.
Hi @alexandru-slobodcicov.
I tried your suggestion, but it didn't work. Can you please provide a fully tested new example that works in here? https://github.com/liquibase/liquibase-mongodb/blob/main/src/test/resources/liquibase/ext/json
Thank you so much!
from liquibase-mongodb.
Hi @szandany, your example is fine. It is something different hapenning. I suppose the original json parser was picked up, not mine implementation. You can check integration tests, all are passing. Will try to run as you do using liquibase command line. Suppose should be taken out the yaml .jar from lib. Will let you know the result
from liquibase-mongodb.
Hi @szandany In my logs I get:
[2020-11-07 13:08:54] INFO [liquibase.servicelocator] Cannot load service: liquibase.parser.ChangeLogParser: Provider liquibase.nosql.parser.json.JsonNoSqlChangeLogParser could not be instantiated
I can see in logs provided by you:
[2020-11-01 15:31:13] INFO [liquibase.servicelocator] Cannot load service: liquibase.parser.ChangeLogParser: liquibase.nosql.parser.json.JsonNoSqlChangeLogParser Unable to get public no-arg constructor
A bit different output however the root cause it is it cannot find jackson libraries in {liquibase_home}/lib
Mystery resolved, add to {liquibase_home}/lib:
jackson-annotations-2.11.3.jar
jackson-core-2.11.3.jar
jackson-databind-2.11.3.jar
I will relate a PR to this issue, just noticed dropAll not working by default from CLI
from liquibase-mongodb.
Related Issues (20)
- Support Updates to a collection HOT 7
- MongoDB extension breaks createIndex on MariaDB 10 HOT 5
- Not able to generate the change logs on on mongodb existing database and also index creation not working on json format. HOT 6
- How to execute same change log on different schemas on the same mongo cluster. HOT 1
- liquibase CLI update failing in docker HOT 1
- Not persisting changes to DATABASECHANGELOG HOT 1
- can't set changelog-lock-wait-time-in-minutes parameter to 0 HOT 1
- Version `4.19.1` is not pushed to maven central repo HOT 1
- Unable to create multi key indexing in liquibase HOT 1
- wrong liquibase core dependency in 4.21.0 release
- renameCollection feature HOT 2
- Updating to latest Liquibase causes the checksum to be changed HOT 1
- Bug in commercial version of liquibase related to mongodb HOT 7
- updateMany feature and rename fields in current data HOT 1
- missing liquibase-mongodb jar file for 4.25.0 HOT 2
- Unsupported authMechanism: MONGODB-AWS HOT 1
- Atlas search index HOT 1
- Azure (Cosmos DB API for MongoDB) - index missing
- Is there a way to specify the database name when it's not included in the connection string? HOT 3
- regexReplace/replaceAll is not evaluated in update command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquibase-mongodb.