jagi / meteor-astronomy-examples

http://astronomy.meteor.com
MIT License
18 stars 5 forks source link

How to get the parent doc ? #14

Closed dvjeshka closed 7 years ago

dvjeshka commented 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 []
            }

        },
    },

});
lukejagodzinski commented 7 years ago

You can't get parent doc from child. It was already discussed. Please use the search feature on GH.