Closed dvjeshka closed 7 years ago
const DiscountCodes = Class.create({ name: 'DiscountCodes', fields: { percent: { type: Number, default:1, validators: [{ type: 'gte', resolveParam(args) { return parent(args.doc,level); } }] }, }); export const Widgets = Class.create({ name: 'Widgets', collection: new Mongo.Collection('widgets'), behaviors: ['timestamp'], fields: { discountCodes:{ type: [DiscountCodes], default: function () { return [] } }, }, });
You can't get parent doc from child. It was already discussed. Please use the search feature on GH.