Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to generate the change logs on on mongodb existing database and also index creation not working on json format. #299

Open
muralikrishna-kumpatla opened this issue Oct 20, 2022 · 6 comments

Comments

@muralikrishna-kumpatla
Copy link

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"}

`

@oliallan14
Copy link

oliallan14 commented Oct 20, 2022

Mongo extension does not support generateChangeLog

For the index, you need to specify the keys tag

see here for an example

@muralikrishna-kumpatla
Copy link
Author

muralikrishna-kumpatla commented Oct 20, 2022 via email

@muralikrishna-kumpatla
Copy link
Author

@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.

@oliallan14
Copy link

sorry I am not sure if json format supports indexing

@tabbyf00
Copy link

tabbyf00 commented Nov 7, 2022

We're checking with 4.23.0 to see if we can reproduce this.

@tati-qalified
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants