2016-03-29 4 views
0

他のアプリケーションデータベースに接続し、そこに保存されているデータを変更する管理パネルを構築しようとしています。Meteor Admin Microservice via DDP

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です。

フロールーターでルーティングを処理する予定です。ありがとう

答えて

0

おそらくconsole.logをonReadyコールバックに入れるだけです。

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