> For the complete documentation index, see [llms.txt](https://yeti-dev.gitbook.io/apollo-server-adonis-directive-pack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yeti-dev.gitbook.io/apollo-server-adonis-directive-pack/api/mutation/createmany.md).

# @createMany

Create many new Lucid models with the given arguments.

{% 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
}
```
