Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Meteor 客户端上的Collection2 autoValue:访问被拒绝_Meteor_Schema - Fatal编程技术网

Meteor 客户端上的Collection2 autoValue:访问被拒绝

Meteor 客户端上的Collection2 autoValue:访问被拒绝,meteor,schema,Meteor,Schema,在服务器上定义autoValue时,它可以正常工作: slug: { type: String, index: true, unique: true, autoValue: function () { var title = this.field("title"); if (Meteor.isServer && title.isSet) return Helpers.slugify(titl

在服务器上定义autoValue时,它可以正常工作:

slug: {
    type: String,
    index: true,
    unique: true,
    autoValue: function () {
        var title = this.field("title");

        if (Meteor.isServer && title.isSet)
            return Helpers.slugify(title.value);
    }
}
但是,如果我也要在客户端上运行定义autoValue,如下所示:

slug: {
    type: String,
    index: true,
    unique: true,
    autoValue: function () {
        var title = this.field("title");

        if (title.isSet)
            return Helpers.slugify(title.value);
    }
}
每当我更新文档标题时,访问被拒绝

但是,对于更新的_at字段,它同时适用于服务器和客户端:

updated_at: {
    type: Date,
    autoValue: function() {
        return new Date();
    }
}
你知道为什么我不能在客户端自动计算slug的值吗?

结果是我在更新时遇到了一个.deny。拆下它就可以修复它了