gpt4 book ai didi

meteor - 为什么 Meteor Collection2 使我的应用程序崩溃并出现错误 : undefined is not allowed by the schema

转载 作者:行者123 更新时间:2023-12-02 04:40:21 24 4
gpt4 key购买 nike

我刚刚将 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

它使我的应用程序崩溃并出现错误:

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)

我正在运行 Meteor 0.9.0。我正在将架构代码附加到服务器上。我不知道我做错了什么。我什至尝试删除除 _id 之外的所有架构字段,但它仍然不起作用。

最佳答案

注意 - 如果您使用 mizzao:user-status 来解决此问题,您只需要允许该包将 status 字段添加到您的用户文档中:

Schema.User = new SimpleSchema(
...
status: {
type: Object,
optional: true,
blackbox: true
}
});

关于meteor - 为什么 Meteor Collection2 使我的应用程序崩溃并出现错误 : undefined is not allowed by the schema,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25707573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com