【问题标题】:Meteor Admin Microservice via DDP通过 DDP 的 Meteor Admin 微服务
【发布时间】:2016-07-17 16:51:08
【问题描述】:

我正在尝试构建一个管理面板,该面板将连接到另一个应用程序数据库并能够更改存储在那里的数据。

var remote = DDP.connect('http://localhost:3000/');
var ServerAItems = new Mongo.Collection('items', { connection: remote  });

Meteor.startup(function() {
  console.log(remote);
  remote.subscribe('smallBatchProducts', function(item){
});
  console.log(ServerAItems.find().count(), 'test');
 });
ServerAItems.find().count(); //returns 0

我查看了 Meteor: No docs from remote collection in template helper when connecting two apps via DDPConnect two Meteor applications using DDP ,但仍然无法弄清楚如何与数据交互并让客户端访问它。 localhost:3000 上的发布是 smallBatchProducts。

我打算让 Flow Router 处理路由。谢谢

【问题讨论】:

    标签: meteor ddp


    【解决方案1】:

    您可能应该将您的 console.log 放入 onReady 回调中。

    Meteor.startup(function() {
      remote.subscribe('smallBatchProducts', {
        onReady: function(){
          console.log(ServerAItems.find().count(), 'test');
        },
        onError: function(err) {}
      });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-05
      • 2013-05-19
      • 2015-02-08
      • 2017-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多