graphql-compose / graphql-compose/graphql-compose-mongoose

Using a Map field

Open
#238 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

I have a schema that looks like -
```
let jobSchema = mongoose.Schema({
jobuuid: { type: String },
type: { type: String },
jobDetails: { type: Types.Mixed },
jobOptions: {
type: Map,
of: JobOptionsSchema
},
})
```
And trying to use a mutation that looks like -
```
mutation{
createJob(record:{jobOptions:{name:"demo"}}){
recordId
}
}
```
But im getting an error-
```
{
"errors": [
{
"message": "job validation failed: jobOptions: Cast to Map failed for value \"[Object: null prototype] { name: 'matthew' }\" at path \"jobOptions\"",
"locations": [
{
"line": 2,
"column": 3
}
],
"stack": [],
"path": [
"createJob"
]
}
],
"data": {
"createJob": null
}
}
```
Did something change with how to use the Map field?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.