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. |
Database
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Database( name, [database] )
database( name, [database] )
Database( name )
ScopedDatabase( name, database )
Database( name, [database] )
Database( name, [database] )
Database( name, [database] )
Description
The Database
function returns a valid Reference for the specified
child database name
, within the specified child database
. If a child
database
is not specified, the returned database reference belongs to
the current database.
The Database
function only looks up child databases, so finding a
database using this function requires you to use an admin key for the
current database (a server or client key cannot be used to access any
child database).
It is not possible to access a parent or peer database with this function. To access databases outside of the current database, use the Fauna Dashboard. |
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
String |
The name of a database. |
|
Reference |
Optional - A Reference to a child database. If not specified, the current database is used. A Reference to a child database. Optional - A Reference to a child database. If not specified, the current database is used. Optional - A Reference to a child database. If not specified, the current database is used. Optional - A Reference to a child database. If not specified, the current database is used. Optional - A Reference to a child database. If not specified, the current database is used. Optional - A Reference to a child database. If not specified, the current database is used. |
Returns
A reference to a child database with the specified name
, in the
specified child database
(or the current database is database
is not
specified).
Examples
-
The following query gets a Reference to the database named "prydain" within the current database:
Database("prydain")
Ref(id=prydain, collection=Ref(id=databases))
{prydain 0xc000162090 0xc000162090 <nil>}
RefV(id = "prydain", collection = RefV(id = "databases"))
ref(id = "prydain", collection = ref(id = "databases"))
Database("prydain")
-
The following query gets a Reference to the database named "grandchild_db" within the child database named "prydain":
Database("grandchild_db", Database("prydain"))
Ref(id=grandchild_db, collection=Ref(id=databases), database=Ref(id=prydain, collection=Ref(id=databases)))
{grandchild_db 0xc00008e2d0 0xc00008e2d0 0xc00008e330}
RefV(id = "grandchild_db", collection = RefV(id = "databases"), database = RefV(id = "prydain", collection = RefV(id = "databases")))
ref(id = "grandchild_db", collection = ref(id = "databases"), database = ref(id = "prydain", collection = ref(id = "databases")))
Database("grandchild_db", Database("prydain"))
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!