Closed jrgleason closed 12 years ago
hmm, it looks like the mongodb-native module isn't being passed correctly. how are you passing it in?
var Db = require('mongodb').Db; var Connection = require('mongodb').Connection; var Server = require('mongodb').Server; var BSON = require('mongodb').BSON; var ObjectID = require('mongodb').ObjectID; var GridStore = require('mongodb').GridStore; var Grid = require('gridfs-stream')(Db); var gfs = null;
PlaylistProvider = function(){}; PlaylistProvider.prototype.dummyData = [];
PlaylistProvider = function(host, port) { this.db= new Db('myRadio', new Server(host, port, {auto_reconnect: true}, {})); gfs = Grid(this.db) this.db.open(function(err,db){ db.authenticate(dbuser,dbpassword, function(err, result) {}); }); };
Also... console.log(gfs.db.options) outputs.. {} like expected console.log(gfs.mongo) outputs { [Function: Db] super_: [Function: EventEmitter], DEFAULT_URL: 'mongodb://localhost:27017/default', connect: [Function] }
Even this seems to work... var test = new GridStore(gfs.db, filename, 'r',{})
ah, try this:
var Grid = require('gridfs-stream')(require('mongodb'))
That seems to have fixed it thanks!
:D
The code looks as follows...
I see the following in the db..
But when I run this I get...
This seems to be exactly the same as the example, my package.json says my mongo is 1.0.2 but when I try to upgrade it, the 2.0.5 version is not it the main repos.