【发布时间】:2017-12-03 05:28:33
【问题描述】:
使用 autoform,似乎数据是从 autoform 传递的,因为我服务器上的 Meteor 方法确实获取了数据,但是在我的方法内部进行数据库更新不会更新我的数据库...我错过了什么?
自动生成代码...
{{> quickForm collection="Rooms" type="method-update"
doc=this autosave=true id=makeUniqueID
meteormethod="updateRoom"}}
流星法:
updateRoom: function (room) {
console.log(room);
Rooms.update({_id: room._id}, { $set: {
checkIn: room.checkIn,
checkOut: room.checkOut,
tenantID: room.tenantID,
available: room.available,
needCleaning: room.needCleaning,
}});
},
我的允许/拒绝规则:
Rooms.allow({
insert() { return false; },
update() { return false; },
remove() { return false; }
});
Rooms.deny({
insert() { return true; },
update() { return true; },
remove() { return true; }
});
以下是我从我的流星方法中的控制台登录得到的。所以我确实得到了更改(在这种情况下,将tenantID 和 false 更改为可用),但它不会在数据库中更新。我在某处遗漏了一些细节,但此时看不到。
【问题讨论】: