2016-07-06 130 views
0

當顯示一組更新表單時,我收到了此控制檯消息。據我所知,我已經正確地遵循了Autoform示例。誰能告訴我我做錯了什麼?控制檯中的SimpleSchema.clean消息

SimpleSchema.clean:過濾掉,將影響到關鍵的 「_id」,這是不是由架構

路徑允許值:form.html

{{#each student}} 
    {{#autoForm id=makeUniqueID type="update" collection="StudentHistory" doc=this}} 
    <div class="panel panel-default edit-profile-margin-pannel"> 
     <div class="panel-body"> 
      {{> afQuickField name='class'}}          
     </div>           
    </div> 
    {{/autoForm}} 
{{/each}} 

路徑:form.js

Template.form.helpers({ 
    student: function() { 
     return StudentHistory.find({}); 
    }, 
    makeUniqueID: function() { 
     return "update-each-" + this._id; 
    } 
}); 

Path:Schema.js

StudentHistory = new Mongo.Collection("studentHistory"); 

StudentHistory.allow({ 
    insert: function(userId, doc) { 
     return !!userId; 
    }, 
    update: function(userId, doc) { 
     return !!userId; 
    }, 
    remove: function(userId, doc) { 
     return !!userId; 
    } 
}); 


var Schemas = {}; 

Schemas.StudentHistory = new SimpleSchema({ 
    studentUserId: { 
     type: String, 
     autoValue: function() { 
      return this.userId; 
     }, 
     autoform: { 
      type: "hidden" 
     } 
    }, 
    class: { 
     type: String, 
     optional: false  
    } 
}); 

StudentHistory.attachSchema(Schemas.StudentHistory); 
+0

請爲'StudentHistory'集合顯示您的架構代碼。 –

+0

我已經更新了上面的代碼 – bp123

回答

0

我的錯誤是在模板幫手。當我添加下面的代碼時,消息消失。

Template.form.helpers({ 
    student: function() { 
     return StudentHistory.find({"studentUserId": Meteor.userId()}); 
    } 
});