小编use*_*772的帖子

流星允许Upsert?

尝试将其插入集合时,在控制台中出现此错误:

"更新失败:访问被拒绝.限制集合中不允许进行Upsert."

以下是我指定的允许规则:

if (Meteor.isClient) {
    Meteor.subscribe('customers');
}

customers = Customers

if (Meteor.isServer) {

Meteor.publish('customers', function() {
    return customers.find();
});

customers.allow({

    insert: function (document) {
        return true;
    },
    update: function () {
        return true;
    },
    remove: function () {
        return true;
    }

    });

}
Run Code Online (Sandbox Code Playgroud)

这是upsert部分:

Customer.prototype.create = function ( name, address, phone, cell, email, website, contact, shipping ) {

var attr = {
    name : name, 
    address : address, 
    phone : phone,
    cell : cell,
    email : email,
    website : …
Run Code Online (Sandbox Code Playgroud)

collections upsert meteor

7
推荐指数
1
解决办法
5182
查看次数

标签 统计

collections ×1

meteor ×1

upsert ×1