Error setting up a mongoInternal.RemoteCollection on Meteor


#1

In the terminal I can see all the data I want to use but In the console (browser) I get the error that “database” is not defined.

I put here all the code I’ve wrote so far in each folder:

server folder:
var database = new MongoInternals.RemoteCollectionDriver( "<url>");
c = new Mongo.Collection("r", {
_driver: database
});

   Meteor.publish('r', function() {
     return c.find();
   });

Template:

<template name="testTableddp">

<div>Conexion Test!</div>
{{#each data}}
<div>
<td>{{DataIwantToFind}}</td>
</div> {{/each}}`

Router:

this.route('testTableddp', {
    path: '/testTableddp',
    layoutTemplate: 'testTableddp',
    waitOn: function() {
        return database.subscribe('r');
    },
    data: function() {
        return {
            'data': c.find({
                "post_date": "2014-10-07 09:26:50"
            })
        };
    }

});

#2

var database = ... means it is local to the file in which you define it. Try without var


#3

I’ve just tried without the var and still the same problem. :sweat:


#4

And how u define collection on client side ?


#5

yeah I thing there was the problem, on the client side. I’ve follow the answers posts on stackoverflow and I’ve found the solution by modifying the client side. http://stackoverflow.com/questions/28787886/meteor-database-connection