【问题标题】:Meteor Autoform pushArray with nested schema具有嵌套模式的 Meteor Autoform pushArray
【发布时间】:2015-03-29 15:13:44
【问题描述】:

我将autoform 用于流星。我有一组嵌套模式,如下所示:

addresses: {
  type: [Schemas.address],
  optional: true,
  defaultValue: []
}

我正在尝试使用update-pushArray向数组添加地址

{{> quickForm id="myformid" type="update-pushArray" doc=getDocument collection=getCollection scope="addresses"}}

但我得到了这些宝石:

MinimongoError: Cannot apply $push modifier to non-array

"MongoError: The field 'addresses' must be an array but is of type Object in document {_id: "383EfPJgeZQJFgs72"} [409]"

所以我尝试将它包装在 formToDoc 钩子中的数组中:

SimpleSchema.clean: filtered out value that would have affected key "0", which is not allowed by the schema

所以...是的。这就是我新鲜想法的极限。你有什么?

【问题讨论】:

标签: meteor meteor-autoform


【解决方案1】:

在您发布此问题几天后,update-pushArray 类型似乎存在问题。根据 aldeed,您需要运行 Autoform 5.0.2 和 Meteor 1.0.3.1 或更高版本才能运行。 http://github.com/aldeed/meteor-autoform/issues/788。此外,aldeed 发布了一个示例,可能对 http://autoform.meteor.com/updatepush

有所帮助

【讨论】:

    猜你喜欢
    • 2015-11-24
    • 2015-01-01
    • 2016-02-13
    • 1970-01-01
    • 2015-05-15
    • 2015-05-11
    • 2015-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多