@collection
Specifies the name of the Fauna collection to use instead of a collection named after the GraphQL type.
Arguments
Argument | Type | Required | Description |
---|---|---|---|
|
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") ] }
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!