mooseql
mooseql copied to clipboard
Support array of objects
The array of objects (like books
in below) cause the error TypeError: Cannot read property 'ref' of undefined
const userSchema = new Schema({
name: {
first: { type: String, required: 'first name required' },
last: String
},
school: { type: Schema.Types.ObjectId, ref: 'School' },
books: [{
title: String
subject: String
}]
})
uncaughtException TypeError: Cannot read property 'ref' of undefined
at inheritOpts.forEach.opt (mooseql/src/type/index.js:86:64)
at Array.forEach (native)
at _fields.filter.map.path (mooseql/src/type/index.js:85:19)
at Array.map (native)
at toType (mooseql/src/type/index.js:81:6)
at models.filter.reduce (mooseql/src/type/index.js:31:52)
at Array.reduce (native)
at modelsToTypes (mooseql/src/type/index.js:30:6)
at mooseql (mooseql/src/index.js:6:19)