role.delete()

Learn: Roles

We recommend you use FSL to create and update user-defined roles. See FSL role schema.

Delete a role.

Signature

delete() => { id: id, coll: collection}

Description

This method deletes a document from the Role system collection, and returns a Object with the id and coll identity fields from the deleted role.

Considerations

You can’t delete a role while a database has staged schema.

If the database has no staged schema, using this method is equivalent to making an unstaged schema change. Changes are applied immediately to the database’s active schema.

Avoid concurrent schema changes

Concurrent unstaged schema changes can cause contended transactions, even if the changes affect different resources. This includes unstaged changes made using:

A schema change triggers a transaction that validates the entire database schema. To avoid errors, do one of the following instead:

Parameters

None

Return value

Type Description

type:NullRole

Document doesn’t exist or is inaccessible. See NullDoc.

Examples

Role.byName("customer")!.delete()
Role.byName("customer") /* deleted */

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!