Метеор Разрешить 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;
}
});
}
Вот часть 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 : website,
contact : contact,
shipping : shipping
};
Customers.upsert( Customers.maybeFindOne( attr )._id, attr );
return new Customer( attr );
};