How to Modular a Mongoose Map to a valid type for Apollo-GraphQL Server?
I provided an Example. Basically, a Map is a Key Value list. Is something like this accomplished with interfaces?
Example:
Mongoose Schema
const userSchema = new Schema({
Financials: {
type: Map,
of: new Schema({
q1: {},
q2: {},
})
}
});
As a Document
{
"Financials":{
"2019":{
"q1":{ },
"q2":{ }
},
"2012":{
"q1":{ },
"q2":{ }
}
}
}
const typeDefs = gql `
type Financials {
}
`