Does Delete performs a Logout?

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:

  1. Create a document
  2. Create a token on it (which can be done like this besides of Login)
Create(Tokens(), {instance: Ref(Collection("somecollection"), "somerefid")})
  1. Look at the tokens:
  1. Delete the document
  2. Look at the 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.