Meteor 在自动窗体方法更新中访问嵌套数组

Meteor 在自动窗体方法更新中访问嵌套数组,meteor,meteor-autoform,Meteor,Meteor Autoform,我试图从更新自动表单生成表单的方法中获取嵌套数组的值 我有一个这样设置的模式 Schema.ContactDetails = new SimpleSchema({ orderedBy: { type: String, label: "Ordered By", optional: true, }, [...] )}; Orders.attachSchema(new SimpleSchema({ [...] orderDetails: { t

我试图从更新自动表单生成表单的方法中获取嵌套数组的值

我有一个这样设置的模式

Schema.ContactDetails = new SimpleSchema({
  orderedBy: {
      type: String,
      label: "Ordered By",
      optional: true,
  },
[...]
)};

Orders.attachSchema(new SimpleSchema({
[...]
orderDetails: {
      type: Schema.OrderDetails,
      optional: true,
      blackbox: true
  },
[...]
)};
然后我用这个设置了一个自动表单

{{#autoForm collection="Orders" id="updateOrderForm" type="method-update" meteormethod="updateOrder" doc=this}}
[...]
{{/autoForm}}
这是更新顺序的方法

updateOrder: function (doc,doc_id) {
    check(doc, Orders.simpleSchema());
    console.log(doc);

    //Modify doc here

    Orders.update({_id: doc_id}, doc); 
  },
上面的
console.log(doc)输出以下内容

{   '$set': 
    { createdBy: 'o5Wye6LLMGNXLn7HY',
        createdAt: Sat Apr 09 2016 22:15:27 GMT+1000 (AEST),
        'contactDetails.orderedBy': 'MvCun8p6vxndj3cr8',
        updatedAt: Mon Apr 11 2016 11:47:31 GMT+1000 (AEST) },
    '$unset': 
    { […]
我的问题是,我需要在updateOrder方法中获取“contactDetails.orderedBy”值,但我似乎无法访问它。我试过以下方法

{   '$set': 
    { createdBy: 'o5Wye6LLMGNXLn7HY',
        createdAt: Sat Apr 09 2016 22:15:27 GMT+1000 (AEST),
        'contactDetails.orderedBy': 'MvCun8p6vxndj3cr8',
        updatedAt: Mon Apr 11 2016 11:47:31 GMT+1000 (AEST) },
    '$unset': 
    { […]
var orderedBy=doc.$set.contactDetails.orderedBy

调用方法“updateOrder”TypeError时出现异常:无法读取未定义的属性“orderedBy”

var orderedBy=doc.$set.'contactDetails.orderedBy'

意外的令牌错误

提前感谢

在这里回答

在这里