Problems using collections from a DDP connection

Hi everyone. I have 2 servers that are connected over DDP and collections on each one.

I would like to be able to perform a findOne on a server side remote collection but I haven’t been able to.

//server 1
//lib/connections.js
commConn = DDP.connect(Meteor.settings.public.commUrl);
Conversations = new Mongo.Collection('conversations', {connection: commConn});

This works as expected.

//server 1
//server/methods.js
Meteor.methods({
  getConversation(id) {
    return Conversations.findOne(id);  //returns undefined
  }
})

I’m trying to figure out why it returns undefined but I haven’t been successful. Does anyone have any experience with this?

commConn is a DDP connection, but Mongo.Collection expects a mongo connection. You will either have to create DDP methods or publications to interact, or make a mongo connection using MongoInternals.

I would start here: https://github.com/meteor/meteor/tree/devel/packages/mongo

Basically you need commConn = new MongoInternals.Connection(/* mongo connection string */);