Hi everyone!
Here’s a quick question.
After deleting a document, all the secret tokens associated (if those exists) are deleted also?
Thank you.
Hi everyone!
Here’s a quick question.
After deleting a document, all the secret tokens associated (if those exists) are deleted also?
Thank you.
They are not, but the tokens would be invalidated. Everything in Fauna is essentially a document (collections, indexes, keys, tokens). See tokens as documents that reference other documents.
If we look at it like that, you are essentially asking for a cascading delete: Cascading delete
You can easily test it as follows:
Create(Tokens(), {instance: Ref(Collection("somecollection"), "somerefid")})
Paginate(Tokens())
Paginate(Tokens())
The token will still be there.
As you can see above, a token is just a document in the Tokens() collection which has a property ‘instance’. That means you can write an index with source Tokens() and [‘data’, ‘instance’] as a term. Upon deleting a document, you can then write some extra FQL to delete the associated tokens as explained in the link about cascading deletes I posted.