Keys

Keys( [database] )
Keys( [database] )
Keys( [database] )
Keys( [database] )
keys( [database] )
Keys( [database] )

Description

The Keys function, when executed with Paginate, returns an array of References for authentication keys associated with the specified child database. If a child database is not specified, the returned key references all belong to the current database.

When a child database is specified, an admin key must be used to call Keys (server or client keys, or ABAC tokens, cannot be used to access a 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 authentication keys in the specified child database (or the current database if database is not specified).

Examples

The following query gets the references to all keys in the current database:

client.Query(Paginate(Keys()));
{
  "object": {
    "data": [
      {
        "@ref": {
          "id": "251385778164204032",
          "collection": {
            "@ref": {
              "id": "keys"
            }
          }
        }
      }
    ]
  }
}
result, _ := client.Query(f.Paginate(f.Keys()))

fmt.Println(result)
map[data:[{251385778164204032 0xc0000a9350 0xc0000a9350 <nil>}]]
System.out.println(
    client.query(
        Paginate(Keys())
    ).get());
{data: [ref(id = "251385778164204032", collection = ref(id = "keys"))]}
client.query(
  q.Paginate(q.Keys())
)
.then((ret) => console.log(ret))
{ data: [ Ref(Keys(), "251385778164204032") ] }
print(client.query(
  q.paginate(q.keys())
)
{'data': [Ref(id=251385778164204032, collection=Ref(id=keys))]}
println(Await.result(
  client.query(
    Paginate(Keys())
  ),
  5.seconds
))
{data: [ref(id = "251385778164204032", collection = ref(id = "keys"))]}

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!