FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. Fauna accounts created after August 21, 2024 must use FQL v10. These accounts will not be able to run FQL v4 queries or access the v4 Dashboard. For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions. |
CreateDatabase
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
CreateDatabase( param_object )
create_database( param_object )
CreateDatabase( param_object )
CreateDatabase( param_object )
CreateDatabase( param_object )
CreateDatabase( param_object )
Description
The CreateDatabase
function adds a new child database in the current
database with the specified parameters. It requires an
admin key.
It is not possible to create a parent or peer database with this function. To create a database outside of the current database, use the Fauna Dashboard. |
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Object |
The |
param_object
Field Name | Field Type | Definition and Requirements | ||
---|---|---|---|---|
|
String |
The name of a database. Cannot be |
||
|
Object |
Optional - A JSON object to contain user-defined metadata for the database. It is provided for the developer to store information at the database level. |
||
|
Integer |
Optional - A relative weight between 1 and 500, inclusive, indicating how many resources this database is allowed to utilize. Defaults to 1. A higher number means more resources.
|
||
|
Timestamp |
Optional - A timestamp that indicates the time-to-live for a document,
which is when the document is removed from the collection and can’t be
queried. The document history can continue to be accessed using
the |
Returns
An object containing the metadata of CreateDatabase
operations.
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
Reference |
A Reference to the database that was created. |
|
String |
The name of the database just created. |
|
Long |
The timestamp, with microsecond resolution, associated with the creation of the database. |
|
Object |
Included only when specified during database creation. An object containing user-defined metadata for this database. |
|
String |
A read-only string that provides a globally-unique identifier for this database. |
Examples
The following query creates a database named "db-next" and returns the reference to the database, the name of the database, and the time the database was created:
{
ref: Database("db-next"),
ts: 1592054207370000,
name: 'db-next',
global_id: 'yqhq17umsybyy'
}
{'ref': Ref(id=db-next, collection=Ref(id=databases)), 'ts': 1592856487080000, 'name': 'db-next', 'global_id': 'yq76pr57aybyy'}
map[global_id:yx18tp8ogydyy name:db-next ref:{db-next 0xc0000ad290 0xc0000ad290 <nil>} ts:1603747134420000]
ObjectV(ref: RefV(id = "db-next", collection = RefV(id = "databases")),ts: LongV(1603756177320000),name: StringV(db-next),global_id: StringV(yx1enifpkybyy))
{ref: ref(id = "db-next", collection = ref(id = "databases")), ts: 1593464629200000, name: "db-next", global_id: "yq9nin7xhybyy"}
{
ref: Database("db-next"),
ts: 1624310358060000,
name: 'db-next',
global_id: 'yoatgw3icybyy'
}
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!