I’ve been looking through the source and am also trying to get this working. MongoInternals.RemoteCollectionDriver needs to be called on the server only, which is the source of the console error. Log database and post the result
@tidee MongoInternals is a server-side method, you client code shouldn’t be aware of your database connection. Client receives data through DDP using publish/subscribe.
Try this:
a.js
if (Meteor.isServer) {
var database = new MongoInternals.RemoteCollectionDriver("mongodb://127.0.0.1:3001/meteor");
Boxes = new Mongo.Collection("boxes", { _driver: database });
Meteor.publish('boxes', function() {
return Boxes.find();
});
}
b.js
if (Meteor.isClient) {
Meteor.subscribe('boxes');
Boxes = new Mongo.Collection("boxes");
}
Given the approach is setting an internal property of the options Mongo Collection constructor, it’s acceptable for there to be no documentation, but the source is readable ahead of a public api
I have the follwing error: “MongoInternals is not defined”
I have a file with the collection definitions in /imports/api/module/module.js
In my client side called the module file that export the collection (imports/ui/module/module).