1

I am trying to build an Admin panel that will connect to another apps database and have the ability to change the data stored there.

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

I have looked at Meteor: No docs from remote collection in template helper when connecting two apps via DDP and Connect two Meteor applications using DDP , but still can't figure out how to interact with the data and give the client access to it. The publication on localhost:3000 is smallBatchProducts.

I'm planning to have Flow Router handle the routing. Thanks

Community
  • 1
  • 1
jaysig
  • 71
  • 1
  • 2
  • 7

1 Answers1

0

You should probably just put your console.log into the onReady callback.

Meteor.startup(function() {
  remote.subscribe('smallBatchProducts', {
    onReady: function(){
      console.log(ServerAItems.find().count(), 'test');
    },
    onError: function(err) {}
  });
});
webdeb
  • 12,993
  • 5
  • 28
  • 44