meteor从第二个mongo数据库中得不到数据

IAM全新的meteor,我试图build立一个应该显示数据另一个Mongo数据库的meteor应用程序。 它自己可以使用自己的metor数据库的应用程序。 所以我发现,与MongoInternals.RemoteCollectionDriver()它连接我的第二个数据库。

下一步是让它在meteor教程中工作。 但是我不从第二个数据库取回任何数据。 对于testing,简单的数组从我的函数返回正确,并放置到Web应用程序。 而.find()的expression式也应该是可以的。 我在Mongo控制台中testing了它。

如果与第二个数据库的连接放置在if (Meteor.isClient)或客户端/服务器部分之外,则出现错误“ReferenceError:MongoInternals is not defined”。 如果它在if (Meteor.isServer)里面设置,有时会在控制台出现exception:

模板助手中的exception:。 ris_sessions@http://localhost:3000 /risdd_mongo.js?4fc7111851b4ed2182782e0a368b366cc4e89745:15:17 bindDataContext / <@ http://localhost:3000 / packages /blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:14
……和更多的消息

我不能看到,为什么不从第二个数据库取回任何数据。

这里是来源:

 Tasks = new Mongo.Collection("tasks"); ////////////////////// if (Meteor.isClient) { Template.body.helpers({ tasks: function() { return Tasks.find({}, {sort: {createdAt: -1 }}); } , s_sessions: function() { return ris_sess.find( {},{description:1} ).fetch(); } }); } ////////////////////// if (Meteor.isServer) { Meteor.startup(function () { // code to run on server at startup var risdb_drv = new MongoInternals.RemoteCollectionDriver("mongodb://172.0.0.1:27017/ris"); var ris_sess = new Mongo.Collection("sessions", { _driver: risdb_drv }); }); } 
 <head> <title>foo</title> </head> <body> <div class="container"> <header> <h1>todo list</h1> <!-- add a FORM !--> <form class="new-task"> <input type="text" name="text" placeholder="ad your task here" /> </form> </header> <ul> {{#each tasks}} {{>task}} {{/each}} {{#each ris_sessions}} {{>ris_session}} {{/each}} </ul> </div> </body> <template name="task"> <li>{{text}}</li> </template> <template name="ris_session"> <li>{{description}}</li> </template> 

如果您使用本地MongoDB服务器,请尝试更改

 mongodb://172.0.0.1:27017/ris 

 mongodb://127.0.0.1:27017/ris 

在IP中input:127