更新时间:2022-12-18 09:12:40
/ code>
doc = _(doc).pick(Entries.allowed);
您正在覆写 doc
variable ,使其不再指向实际的 doc
对象。
You're overwriting the doc
variable so that it no longer points to the actual doc
object. What you want is to change the object itself.
您需要 delete
all未列入白名单的 doc
属性。示例实现:
You need to delete
all the doc
properties that are not whitelisted. Example implementation:
insert: function(userId, doc) {
var keys = _.keys(doc);
keys = _.difference(keys, Entries.allowed);
_.each(keys, function(key) {
delete doc[key];
});
}