Closed gsi-alejandro closed 1 year ago
ArrayType options are set to undefined even when you use some options.
undefined
Current behavior: Define schema like this:
const userSchema = new Schema({ test: {default: ()=>[], type: [{type: String, ref: 'Article'}]} });
Produce:
ArrayType { name: 'Article', typeName: 'Array', options: undefined, itemType: ReferenceType { name: '', typeName: 'Reference', options: undefined, schema: Schema { statics: {}, methods: {}, preHooks: {}, postHooks: {}, index: {}, queries: {}, options: [Object], fields: {} }, refModel: 'Article' } }
Notice: options were set to undefined
Correct behavior should be:
ArrayType { name: 'Article', typeName: 'Array', options: {default: ()=>[]}, itemType: ReferenceType { name: '', typeName: 'Reference', options: undefined, schema: Schema { statics: {}, methods: {}, preHooks: {}, postHooks: {}, index: {}, queries: {}, options: [Object], fields: {} }, refModel: 'Article' } }
Notice: options has the default value set (options: {default: ()=>[]},)
options: {default: ()=>[]},
ArrayType options are set to
undefined
even when you use some options.Current behavior: Define schema like this:
Produce:
Notice: options were set to
undefined
Correct behavior should be:
Notice: options has the default value set (
options: {default: ()=>[]},
)