Databases

reference:

Fauna implements a new architecture that differs from other databases you might be familiar with. A database is a logical construct for grouping other documents. There is no notion of resource provisioning or warmup wait interval. When you create a database, the result is instantaneous. More importantly, there is no limit to the number of databases you can create.

Database structure

A database is a logical grouping of documents. A database can have a schema definition document that describes the database structure. These include collections, functions, child databases, and user-created documents.

Databases exist in the system-global root database context. Other than keys, all other documents exist in the context of a database.

Databases have immutable history in that you can’t insert events with timestamps in the past. This means that after a database is deleted, it can’t be resurrected.

Field Type Definition and Requirements

name

Name of the database.

global_id

A read-only string that provides a unique global identifier for this database.

data

(Optional) A JSON object with metadata about this database.

Operational constraints

Queries are limited to a single database and can’t span databases.

You can rename a database by updating its name field. Renaming a database changes its reference but preserves inbound references to the database. Data in a renamed database remains accessible using existing keys.

Delete a database

You can delete a database using the Fauna Dashboard or the Fauna CLI's delete-database command.

You can also use the Database collection’s delete() method to delete child databases in FQL queries.

Considerations

When you delete a database, its data becomes inaccessible and is asynchronously deleted. As part of the deletion process, Fauna recursively deletes:

  • Any keys scoped to the database.

  • The database’s child databases, including any nested databases.

Deleting a database with a large number of keys can exceed Transactional Write Ops throughput limits and cause errors with a 429 (Capacity limit) HTTP status code.

Deleting a database with a large number of child databases can cause errors with a 440 (Client timeout) HTTP status code.

To avoid throttling or timeouts, incrementally delete all keys and child databases before deleting the database. See delete all keys and delete all child databases.

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!