Closed bwgjoseph closed 3 years ago
@bwgjoseph yeah maxExpiry is the means to add TTL at a collection level. You are right currently maxExpiry defaults to 5 minutes which is INCORRECT. The default value is indefinite i.e 0. There seems to be an underlying issue with Nodejs sdk when talking from Ottoman. Our developers are looking into it. For now set the value to your desired value.
So I also did a test to set in the value, but it isn't reflected correctly as well.
If you see my initial post, it set it to 10000
and the document still shows 0
in couchbase
Yeah probably all related.
@AV25242 I tested with beta.2
, passed in maxExpiry
to 10000
but the document created is still 0
How do I use this TTL feature?
Yeah you are using it the right way, not sure why the value is not honored. Team is looking into it
hi @bwgjoseph I dont see any issues with Beta-2.0
I created a ttlCheck Collection (new) and as you see in the screenshot below the collection is created with a TTL of 1000 if you are using an existing collection then you will have to drop it and re-create.
Note maxExpiry setting cannot be updated on a collection.
Next I programmatically created a document
And then checked the Expiry on it and I did see an expiration set thats other than 0
like you were seeing.
What I suspect is that most likely you were attempting to add the maxExpiry to a collection that you already created and were expecting the TTL to be set.
Oh btw the value is in SECOND. The documentation will be updated with the next release to mention that :)
I think you're right. I tested with a new collection, and it seems to be working fine.
Is there any way to set the expiry per document instead of per collection? I do have some use-case for it
I mean whatever that is defined in the ModelOptions
could be the default expiry for all documents in that collection but if one of my documents has a different expiry than what was declared in the ModelOptions
then during the document creation, maybe it could allow me to specify the expiry? Possible?
Can you create a new ticket and close this one. This one suffice the needs of TTL for all documents, the ask is at at an operation level.
Sure!
Hi,
Would like to check maxExpiry in
ModelOptions
and what does it mean exactlyThe explanation given in the doc is
And based on what I understand/know, that seems to be to indicate the TTL of the document? Does this mean to say after 5 mins, the document will be automatically removed?
During my test, that doesn't seem to be the case.
So may I know what is that
maxExpiry
option is used for? How do I useTTL
feature if I want to?