Skip to content

TypeError: db.Collection is not a function #72

@raztud

Description

@raztud

From your example

exports.up = function (db, next) {
    var pets = db.Collection('pets');
    pets.insert({name: 'tobi'}, next);
};

I get TypeError: db.Collection is not a function
when I run
./node_modules/mongodb-migrate -runmm -dbc {"host":"localhost","db":"mydb","port":27017} up

Full trace:

at Migration.exports.up (migrations/0100-migrate.js:5:17)
    at next (node_modules/mongodb-migrate/lib/set.js:161:24)
    at Set._migrate (node_modules/mongodb-migrate/lib/set.js:212:2)
    at node_modules/mongodb-migrate/lib/set.js:102:8
    at Set.load (node_modules/mongodb-migrate/lib/set.js:59:2)
    at Set.migrate (node_modules/mongodb-migrate/lib/set.js:93:7)
    at Set.up (node_modules/mongodb-migrate/lib/set.js:79:7)
    at node_modules/mongodb-migrate/index.js:312:19
    at handleCallback (node_modules/mongodb/lib/utils.js:120:56)
    at node_modules/mongodb/lib/cursor.js:861:16
    at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
    at setCursorDeadAndNotified (node_modules/mongodb-core/lib/cursor.js:505:3)
    at nextFunction (node_modules/mongodb-core/lib/cursor.js:608:12)
    at Cursor.next [as _next] (node_modules/mongodb-core/lib/cursor.js:701:3)
    at fetchDocs (node_modules/mongodb/lib/cursor.js:857:10)
    at node_modules/mongodb/lib/cursor.js:880:7

Version:

npm view mongodb-migrate version
2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions