2017-01-12 34 views
0

我有一個集合「項」設置和定義的流星服務器端方法:是否可以直接在流星外殼上調用服務器端方法?

import { Meteor } from 'meteor/meteor'; 
import { Mongo } from 'meteor/mongo'; 
import { check } from 'meteor/check'; 

export const Entries = new Mongo.Collection('entries'); 

if (Meteor.isServer) { 
    // This code only runs on the server 
    Meteor.publish('entries', function entriesPublication() { 
     return Entries.find({$or: [ 
     { id_user: this.userId }, 
     ],}); 
    }); 
} 

Meteor.methods({ 
'entries.setPosition'(entryId, position) { 
     check(entryId, String); 
     check(position, Number); 

     Entries.update(entryId, { $set: { position: position } }); 
}); 

是否有可能以某種方式調用entries.setPosition()的流星或蒙戈外殼採用不同的參數,看看結果如何?我想避免直接在控制檯上重寫或粘貼(這會格式化)整個mongo查詢。如何在執行函數後看到受影響的行?

+0

爲什麼不直接使用節點調試器? https://coderwall.com/p/eqecca/server-debugging-with-meteor –

回答

0

是的,你會這樣做,就像從客戶端調用。

相關問題