# @createMany

{% hint style="warning" %}
Required argument when writing a mutation:

* input - type Input (array)
  {% endhint %}

### For a separate add use

```javascript
/* ... */
const {
  CreateManyDirective,
  CreateManyTypeDefs
} = require('apollo-server-adonis-directives-pack/src/directives/mutation/CreateMany')

makeExecutableSchema({ 
  /* ... */ 
  typeDefs: [ CreateManyTypeDefs, /* ... */ ],
  schemaDirectives: { CreateManyDirective, /* ... */} 
})
```

### Definition

{% code title="CreateManyTypeDefs" %}

```graphql
directive @createMany(
  # By default, the model will be calculated from the name
  # of the returned "type" with the prefix 'App/Model/'
  model: String) on FIELD_DEFINITION
```

{% endcode %}

{% hint style="success" %}
Use the @createMany directive only to create many new models
{% endhint %}

### Example

```graphql
input CreatePostInput {
    name: String!
    text: String
}

type Mutation {
    createManyPost(input: [CreatePostInput!]!): [Post] @createMany
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeti-dev.gitbook.io/apollo-server-adonis-directive-pack/api/mutation/createmany.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
