afloyd / mongo-migrate

MIT License
159 stars 81 forks source link

Error: collection name must be a String #52

Closed zirho closed 8 years ago

zirho commented 8 years ago
$node ./node_modules/mongodb-migrate -runmm

Connected correctly to server
  up : migrations/0005-add-posts.js
Error inside migration:  migrations/0005-add-posts.js
Error:  [Error: collection name must be a String]
var mongodb = require('mongodb');

exports.up = function(db, next){
  var posts = mongodb.Collection(db, 'posts');
  posts.insert({title: 'post awef'});
  next();
};
exports.down = function(db, next){
  next();
};

Hi, I can't figure out what's wrong with my code

thanks.

zirho commented 8 years ago

Oh this is because I was using mongo <= 2.x I think I should require mongo 3.x manually to use above 3.0