CreateDatabase
CreateDatabase( param_object )
Description
The CreateDatabase
function adds a new database to the cluster with
the specified parameters. It requires an admin key for authentication.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
The param_object fields are described below. |
param_object
Field Name | Field Type | Definition and Requirements | ||
---|---|---|---|---|
|
The name of a database. Databases cannot be named any of the following
reserved words: |
|||
|
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. |
|||
|
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.
|
Returns
An object containing the metadata of CreateDatabase
operations.
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
The reference is an automatically generated unique identifier for the database that was created. |
|
|
The name of the database just created. |
|
|
The timestamp, with microsecond resolution, associated with the creation of the database. |
|
|
Included only when specified during database creation. An object containing user-defined metadata for this database. |
|
|
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:
client.query(q.CreateDatabase({ name: 'db-next' }))
.then((ret) => console.log(ret))
{ ref: Ref(id=db-next, collection=Ref(id=databases)),
ts: 1527274824500534,
name: 'db-next' }
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!