Not able to create indexes using json format on mongodb and unable to generate change logs on existing mongodb databases to capture the changes
{
"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"
}
}
}
}]
}
}
]
}
... 67 more
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"}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:195)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:400)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:324)