Database

Database( name )
Database( name )
Database( name )
Database( name )
database( name )
database name
Database( name )
Database( name )

Description

The Database function returns a valid Ref for a given database name. The Database function only looks up child databases, so finding a database using this function requires you to provide an admin key from the parent database.

Parameters

Argument Type Definition and Requirements

name

String

The name of a database.

Returns

A reference to a database with the provided name.

Examples

The query below gets a reference to the database named "prydain".

curl https://db.fauna.com/ \
    -u fnAChGwBacACAEZtRZFDXpyjIvq-sln34m-va4Km: \
    -d '{ "database": "prydain" }'
client.Query(Database("prydain"));
System.out.println(client.query(Database(Value("prydain"))).get());
result, _ := client.Query(f.Database("prydain"))

fmt.Println(result)
client.query(Database("prydain"))
client.query(q.database("prydain"))
$client.query do
  database 'prydain'
end
client.query(Database("prydain"))
client.query(q.Database('prydain'))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": { "@ref": "databases/prydain" } }
{ "@ref": "databases/prydain" }
ref(id = "prydain", collection = ref(id = "databases"))
{prydain 0xc420316a60 <nil>}
{ "@ref": "databases/prydain" }
{ "@ref": "databases/prydain" }
{ "@ref": "databases/prydain" }
{ "@ref": "databases/prydain" }
Ref(id=prydain, collection=Ref(id=databases))

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!