liquibase-mongodb
liquibase-mongodb copied to clipboard
Not able to generate the change logs on on mongodb existing database and also index creation not working on json format.
Hi Team,
Not able to generate the change logs on on MongoDB existing database and also index creation not working on Json format.
I am using liquibase 4.15 and mongodb 4.4 version.
{ "databaseChangeLog": [{ "property": { "name": "collection.name", "value": "person3" } }, { "changeSet": { "id": "12334d", "author": "murali", "changes": [{ "createIndex": { "collectionName": "${collection.name}", "indexQuery": { "clientId": 1,"type": 1 }, "indexOptions": { "$rawJson": { "unique": true, "name": "new_index_key" } } } }] } } ] }
`Caused by: com.mongodb.MongoCommandException: Command failed with error 67 (CannotCreateIndex): 'Error in specification { key: {} } :: caused by :: Index keys cannot be empty.' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "Error in specification { key: {} } :: caused by :: Index keys cannot be empty.", "code": 67, "codeName": "CannotCreateIndex"}
`
Mongo extension does not support generateChangeLog
For the index, you need to specify the keys tag
Thank for the reply. Currently we are using XML format only. I want to know whether json indexing works or not?
On Thu, Oct 20, 2022, 6:19 PM oliallan14 @.***> wrote:
Mongo extension does not support generateChangeLog
For the index, you need to specify ext:keys tag
see here for an example https://github.com/liquibase/liquibase-mongodb/blob/main/src/test/resources/liquibase/ext/changelog.create-index.test.xml
— Reply to this email directly, view it on GitHub https://github.com/liquibase/liquibase-mongodb/issues/299#issuecomment-1285487284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMLP2OBQWWLQD7CRB7NZVDWEE5WZANCNFSM6AAAAAARKDKERQ . You are receiving this because you authored the thread.Message ID: @.***>
@oliallan14 Thanks for the reply. Currently we are using XML format only. I want to know whether json format supports indexing or not? , I have to generate the Liquibase change for an existing database.
sorry I am not sure if json format supports indexing
We're checking with 4.23.0 to see if we can reproduce this.
It seems like the code generated by the changelog is leaving the "key" value of createIndex(key, options)
empty, even when keys are specified in the changeset.
This is still an issue in version 4.23.0