Databases

Databases( [database] )
Databases( [database] )
Databases( [database] )
Databases( [database] )
databases( [database] )
databases [database]
Databases( [database] )
Databases( [database] )

Description

The Databases function, when executed with Paginate, returns an array of References for child databases in the specified child database. If a child database is not specified, the returned child database references all belong to the current database.

The Databases function only reports 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).

Parameters

Argument Type Definition and Requirements

database

Optional - A reference to a child database. If not specified, the current database is used.

Returns

A Set reference for the available databases in the specified child database (or the current database if database is not specified).

Examples

The query below retrieves the references to sub-databases within the current database:

curl https://db.fauna.com/ \
    -u fnAChGwBacACAEZtRZFDXpyjIvq-sln34m-va4Km: \
    -d '{ "paginate": { "databases": null } }'
client.Query(Paginate(Databases()));
System.out.println(client.query(Paginate(Databases())).get());
result, _ := client.Query(f.Paginate(f.Databases()))

fmt.Println(result)
client.query(Paginate(Databases()))
client.query(q.paginate(q.databases()))
$client.query do
  paginate databases
end
client.query(Paginate(Databases()))
client.query(q.Paginate(q.Databases()))
.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!