Warning
DEFINE SCOPE statement
Setting scope access allows SurrealDB to operate as a web database. With scopes you can set authentication and access rules which enable fine-grained access to tables and fields.
Requirements
You must be authenticated as a root or namespace user before you can use the
DEFINE SCOPEstatement.You must select your namespace and database before you can use the
DEFINE SCOPEstatement.
Statement syntax
Example usage
Below shows how you can create a scope using the DEFINE SCOPE statement.
Using IF NOT EXISTS clause
The IF NOT EXISTS clause can be used to define a scope only if it does not already exist. If the scope already exists, the DEFINE SCOPE statement will return an error.