@collection

Specifies the name of the Fauna collection to use instead of a collection named after the GraphQL type.

Location

Types.

Arguments

Argument Type Required Description

name

String

Yes

The name for the database collection to use for this GraphQL type.

Description

The @collection directive controls the name of the underlying database collection for the annotated type. By default, the GraphQL API uses the name of a type as the name of the collection in the database.

Example

Given the following GraphQL schema:

type User @collection(name: "users") {
  name: String
}

The database collections would be:

Paginate(Collections())
{ data: [ Collection("users") ] }

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums or email docs@fauna.com

Thank you for your feedback!