graphql-compose / graphql-compose/graphql-compose-mongoose
Issue with createMany resolver
- Dominant language
- TypeScript
- Stars
- 706
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
I just discovered this project and I am so glad I did!
However, I am having a problem with version 4.6.0. I am using typescript 3.0.1. I have a very simple setup (based on the example in the readme):
```
const customizationOptions = {}; // left it empty for simplicity, described below
const CountryTC = composeWithMongoose(country, customizationOptions);
// STEP 3: Add needed CRUD Country operations to the GraphQL Schema
// via graphql-compose it will be much much easier, with less typing
schemaComposer.Query.addFields({
countryById: CountryTC.getResolver('findById'),
countryByIds: CountryTC.getResolver('findByIds'),
countryOne: CountryTC.getResolver('findOne'),
countryMany: CountryTC.getResolver('findMany'),
countryCount: CountryTC.getResolver('count'),
countryConnection: CountryTC.getResolver('connection'),
countryPagination: CountryTC.getResolver('pagination'),
});
schemaComposer.Mutation.addFields({
countryCreateOne: CountryTC.getResolver('createOne'),
countryCreateMany: CountryTC.getResolver('createMany'),
countryUpdateById: CountryTC.getResolver('updateById'),
countryUpdateOne: CountryTC.getResolver('updateOne'),
countryUpdateMany: CountryTC.getResolver('updateMany'),
countryRemoveById: CountryTC.getResolver('removeById'),
countryRemoveOne: CountryTC.getResolver('removeOne'),
countryRemoveMany: CountryTC.getResolver('removeMany'),
});
const graphqlSchema = schemaComposer.buildSchema();
export default graphqlSchema;
```
When I launch my app, I get the following exception:
```
/Users/berrymat/GitLab/NexxusTDO/MiddleLayer/node_modules/graphql/type/definition.js:47
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /**
^
TypeError: Cannot call a class as a function
at _classCallCheck (/.../node_modules/graphql/type/definition.js:47:99)
at Object.GraphQLList (/.../node_modules/graphql/type/definition.js:736:5)
at createMany (/.../node_modules/graphql-compose-mongoose/lib/resolvers/createMany.js:74:82)
at names.forEach.resolverName (/.../node_modules/graphql-compose-mongoose/lib/composeWithMongoose.js:105:26)
at Array.forEach ()
at createResolvers (/.../node_modules/graphql-compose-mongoose/lib/composeWithMongoose.js:101:9)
at Object.composeWithMongoose (/.../node_modules/graphql-compose-mongoose/lib/composeWithMongoose.js:49:5)
at Object. (/.../dist/main.js:46985:44)
at __webpack_require__ (/.../dist/main.js:21:30)
at Object. (/.../dist/main.js:45317:25)
at __webpack_require__ (/.../dist/main.js:21:30)
at /.../dist/main.js:64:18
at Object. (/.../dist/main.js:67:10)
at Module._compile (internal/modules/cjs/loader.js:699:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
```
If I revert to version 4.5.3, I no longer get the issue.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.