Export MongoDB symbol in Package in Meteor 0.6.5 -


i need use mongodb driver in meteor because want use grid in application. before meteor 0.6.5, managed have mongodb package, , worked fine.

but after update, new package system, cannot make work. here package.js (in myappfolder/packages/mongodb/), did meteor add mongodb

package.describe({     summary: "mongodb driver" });  npm.depends({'mongodb': '1.3.18'});  package.on_use(function(api){     mongodb = npm.require("mongodb");     console.log(mongodb, '--------------');      api.export('mongodb', 'server'); }); 

i can see console log prints when start server, in application code @ runtime, value of mongodb undefined, same thing package.mongodb.mongodb . seems me these values assigned undefined somehow.

if knows how use included mongodb driver in mongo-livedata package, better solution.

i don't think works if in package.js file; appears have use separate file. did similar csv package, in following way:

package.js:

npm.depends({     csv: "0.3.5" });  package.on_use(function (api) {     api.add_files('server.js', 'server');      api.export('csv'); }); 

server.js:

csv = npm.require('csv'); 

this meteor 0.6.5+ specific. have section in docs now: http://docs.meteor.com/#writingpackages

like said though, should able npm.require same mongodb package meteor using, , save additional npm install. example, mongo-livedata package exports called mongointernals, , may able dig in , find out how pull out mongo driver:

https://github.com/meteor/meteor/blob/devel/packages/mongo-livedata/package.js


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -