Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb 可以直接在meteor shell上调用服务器端方法吗?_Mongodb_Meteor - Fatal编程技术网

Mongodb 可以直接在meteor shell上调用服务器端方法吗?

Mongodb 可以直接在meteor shell上调用服务器端方法吗?,mongodb,meteor,Mongodb,Meteor,我设置了一个集合“条目”,并定义了meteor服务器端方法: 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

我设置了一个集合“条目”,并定义了meteor服务器端方法:

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 } });
});

是否可以使用不同的参数调用meteor或mongo shell中的entries.setPosition()并查看结果?我希望避免直接在控制台上重写或粘贴整个mongo查询(这会弄乱格式)。执行函数后如何查看受影响的行?

是的,您可以这样做,就像从客户端调用一样。

为什么不使用节点调试器?