在水线中执行.create()帮助时提供错误的属性值时,err
json具有以下message
:
[Error (E_VALIDATION) 2 attributes are invalid] Invalid attributes sent to undefined: • username • A record with that 'username' already exists ('someusername'). • email • A record with that
电子邮件already exists ('someemail@gmail.com').
问题是“发送到未定义的Invalide属性”理想情况下应该告诉模型名称而不是undefined。那么为什么会这样呢?
大约两年前在github上开设了一个相关问题:https://github.com/balderdashy/waterline/issues/1118
但是看不到任何回应!
答案 0 :(得分:1)
包含模型js的副本会很有帮助。但是,似乎有验证,特别是模型属性的唯一属性设置为true。从我收集的内容中你已经明白了。无论如何,就未定义的消息而言,它是一个已知问题,在这里你可以阅读: https://github.com/balderdashy/sails/commit/b8c3813281a041c0b24db381b046fecfa81a14b7#commitcomment-18455430
干杯 PS:当我在我的用户表中插入具有即将复制的唯一约束的数据时,我总是得到这些消息。