2017-01-12 40 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

是的,你会这样做,就像从客户端调用。

相关问题