gin-contrib / sessions

Gin middleware for session management
MIT License
1.46k stars 196 forks source link

Mongo driver sets TTL index incorrectly #258

Open bramvbilsen opened 9 months ago

bramvbilsen commented 9 months ago

Setting the TTL for the mongodriver does currently not work as expected. The docs provide the following example (adjusted to trigger error):

maxAge := 30
store := mongodriver.NewStore(c, maxAge, true, []byte("secret"))

This will result in an error due to an integer overflow caused by: https://github.com/laziness-coders/mongostore/blob/05d8c96df4538deba8a65fb43ba45b6e9e5d95df/mongostore.go#L61

This is however fixed in a newer version of the used mongodriver package, as can be seen in this PR: https://github.com/laziness-coders/mongostore/pull/1

I propose updating this dependency to ensure TTL indexes work as expected.