// 20 characters required
Yes, Credential documents, plus Token and Key documents, can have a TTL.
> Get(Ref(Credentials(), "1"))
{
ref: Ref(Credentials(), "1"),
ts: 1615236923980000,
instance: Ref(Collection("users"), "2"),
hashed_password: '$2a$05$7GuEGBk7sQjwHhWkjs9foeVmtwsBM27.MHGT3gaXYRBXusbKNDcEO'
}
> Update(Ref(Credentials(), "1"), { ttl: TimeAdd(Now(), 3, 'days') })
{
ref: Ref(Credentials(), "1"),
ts: 1615311105290000,
instance: Ref(Collection("users"), "2"),
hashed_password: '$2a$05$7GuEGBk7sQjwHhWkjs9foeVmtwsBM27.MHGT3gaXYRBXusbKNDcEO',
ttl: Time("2021-03-12T17:31:45.180Z")
}
> Get(Ref(Credentials(), "1"))
{
ref: Ref(Credentials(), "1"),
ts: 1615311105290000,
instance: Ref(Collection("users"), "2"),
hashed_password: '$2a$05$7GuEGBk7sQjwHhWkjs9foeVmtwsBM27.MHGT3gaXYRBXusbKNDcEO',
ttl: Time("2021-03-12T17:31:45.180Z")
}
If you create a Credential document by adding a credentials
field to a document, there is no opportunity to set the TTL with that approach. You need to directly create or update a Credential document to set the TTL (as in the example above).