liquibase/liquibase-mongodb

createIndex with TTL (expireAfterSeconds) is ignored and normal index created

LawrenceMouarkach opened this issue · 5 comments

Hi,

When using this library I noticed whilst trying to create a TTL that it didnt work and a normal index was created please see below:

Actioned in change-log.xml
image

What was created in mongo:
image

┆Issue is synchronized with this Jira Bug by Unito

@alexandru-slobodcicov thoughts? I might fork this repo and look at fixing it if u do not have time at the moment, I will create a pr here if u want?

More info:

image

image

Change must be made here will work on it now:
image

Wouldnt let me create a pull request, please add following:
BsonUtils
if (options.containsKey("expireAfterSeconds")) { indexOptions.expireAfter(options.getLong("expireAfterSeconds"), TimeUnit.SECONDS); }
BsonUtilsTest
@Test void expireAfterSecondsTest() { assertThat(BsonUtils.orEmptyDocument("{expireAfterSeconds: NumberLong(\"60\")}").getLong("expireAfterSeconds")) .isEqualTo(60L); }

image
image

Thank you @LawrenceMouarkach for the detailed feedback, raised the PR target release 4.2.2.1