collectionDef.delete()

Learn: Collection schema

We recommend you use FSL to create and update user-defined collections. See FSL collection schema.

Delete a collection.

Signature

delete() => NullCollectionDef

Description

Deletes a Collection document.

Collection documents are FQL versions of a database’s FSL collection schema. Collection documents have the CollectionDef type. See Collections.

Staged schema

You can’t delete a collection 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

NullCollectionDef

Document doesn’t exist. See NullDoc.

Examples

Collection.byName("Category")!.delete()
Collection.byName("Category") /* 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!