【发布时间】:2013-02-07 22:00:00
【问题描述】:
考虑案例:
validatedSchema = new schema({
id : "1454216545154",
name: { type: Number, validate: [
function(v){
return (this.id !== Server.LoggedIn.ID);
}, 'Don't try to change the name of another user!!!!'
]}
})
我还没有设置完整的服务器进行测试,但正处于计划阶段。
我们能否从验证函数中访问兄弟元素,在本例中是“id”和“外部”变量?如果是,怎么做?
谢谢
【问题讨论】:
标签: javascript json node.js mongodb mongoose