2016-02-09 87 views
0

下從蒙戈集合所有文件瀏覽器控制檯顯示的收集有記錄,但是當我嘗試Tasks.remove({});在瀏覽器控制檯我得到一些錯誤:刪除流星

errorClass {error: 403, reason: "Not permitted. Untrusted code may only remove documents by ID.", details: undefined, message: "Not permitted. Untrusted code may only remove documents by ID. [403]", errorType: "Meteor.Error"}

不知道如何刪除所有文件從收集包括_id(s)?由於

Meteor.subscribe('tasks'); 
 

 
Meteor.publish('tasks', function(){ 
 
    return Tasks.find(); 
 
});

回答

0

您可以同時在服務器上只刪除多個文檔作爲documented on the Meteor site

因此,要清除集合,您需要在服務器代碼中執行此操作,並在需要從客戶端調用此方法時創建一個方法。