无法读取属性' ObjectId'在Stream.GridWriteStream

时间:2016-04-07 15:18:16

标签: node.js mongodb gridfs gridfs-stream

我收到此错误 - 无法读取属性' ObjectId'在gfs.createWriteStream的Stream.GridWriteStream中未定义。有趣的事情是我的实施工作到昨天一直很好。我无法弄清楚出了什么问题。

var Grid = require('gridfs-stream');

Grid.mongo = mongoose.mongo;
var gfs;

var mongoose = require('mongoose');
    mongoose.connect('mongodb://user:pass@example.com:15879/thing', function (error) {
        if (error) {
            console.log(error);
        }
    });

var conn = mongoose.connection;
conn.once('open', function callback(){
  gfs = Grid(conn.db);
  var writestream = gfs.createWriteStream({
    filename: "secure"
  });
});

0 个答案:

没有答案