是否可以使用Meteor.Call从MongoDB中检索数据?

时间:2015-09-01 13:46:23

标签: cordova meteor

我设法创建了一个帮助程序,一旦从服务器发布,就会返回Collection的数据。

但是,我无法通过使用Meteor.call(即收集服务器端)来检索数据。

这是我的代码:

的客户机/ template.html

<template name="showScannedData">
     <!- .... more code -->
    {{myUserNetId}}
</template>

client / helpers.js (有效的那个)

Template.showScannedData.helpers({
    'myUserNetId': function(){
       return Individuals.findOne().netId; // WORKS
    }
});

client / helpers.js 工作的那个,即空白输出)

Template.showScannedData.helpers({
      return Meteor.call('getmyUserNetId', function(err,res){
          return res;
      });
    }
});

服务器/ db_methods.js

Meteor.methods({
    getmyUserNetId: function(){
        return Individuals.findOne({}).netId;
    }
})

0 个答案:

没有答案