Nea*_*int 2 meteor meteor-collection2
我刚刚将Meteor collection2添加到我的应用程序中.在服务器文件夹的文件中,我添加了代码:
Schema = {}
Schema.User = new SimpleSchema(
_id:
type: String
regEx: SimpleSchema.RegEx.Id
username:
type: String
regEx: /^[a-z0-9A-Z_]{3,15}$/
emails:
type: [Object]
optional: true
"emails.$.address":
type: String
regEx: SimpleSchema.RegEx.Email
"emails.$.verified":
type: Boolean
createdAt:
type: Date
)
Meteor.users.attachSchema Schema.User
Run Code Online (Sandbox Code Playgroud)
它正在崩溃我的应用程序错误:
W20140907-02:06:32.777(-4)? (STDERR) /Users/Nearpoint/.meteor/packages/meteor-tool/.1.0.25.2ltu8i++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20140907-02:06:32.777(-4)? (STDERR) throw(ex);
W20140907-02:06:32.777(-4)? (STDERR) ^
W20140907-02:06:32.792(-4)? (STDERR) Error: undefined is not allowed by the schema
W20140907-02:06:32.792(-4)? (STDERR) at getErrorObject (packages/aldeed:collection2/collection2.js:489)
W20140907-02:06:32.792(-4)? (STDERR) at doValidate (packages/aldeed:collection2/collection2.js:472)
W20140907-02:06:32.792(-4)? (STDERR) at Meteor.Collection.(anonymous function) [as update] (packages/aldeed:collection2/collection2.js:282)
W20140907-02:06:32.792(-4)? (STDERR) at UserConnections.upsert.$set.ipAddr (packages/mizzao:user-status/status.coffee:94:15)
Run Code Online (Sandbox Code Playgroud)
我正在运行Meteor 0.9.0.我在服务器上附加架构代码.我不知道我做错了什么.我甚至尝试删除除_id之外的所有架构字段,但它仍然无效.
注意 - 如果您正在使用mizzao:user-status,要解决此问题,您只需要允许该软件包status向您的用户文档添加字段:
Schema.User = new SimpleSchema(
...
status: {
type: Object,
optional: true,
blackbox: true
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1217 次 |
| 最近记录: |