【发布时间】:2013-10-24 16:21:48
【问题描述】:
我得到了这些会话:
Session.set("group_name",false);
Session.set("group_date",false);
Session.set("group_friends",false);
Session.set("group_location",false);
Session.set("group_rules",false);
Session.set("group_desc",false);
Session.set("group_save",false);
我希望用户只有在所有 Session 的值都不是 false 并且该值有效时才能插入, 例如组名不能是“123”或“a”(我知道我可以使用正则表达式,但我更喜欢使用流星检查和匹配)。
在做:
if(Session.get("group_date") != false && Session.get("group_friends") != false && ...){
CollectionName.insert({name:Session.get("group_name")},...)
}
似乎乏味且错误。
【问题讨论】:
标签: javascript session collections meteor