seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
927 stars 163 forks source link

ERROR: collection name must be a String #275

Closed vladoro closed 3 years ago

vladoro commented 3 years ago

Thanks for the tool, it may useful for some people, but it doesn't work for us.

npm:

mongodb server: 4.0.18

migrate mongo config

const config = env().then(() => ({
  mongodb: {
    url: 'mongodb://localhost:27017/my-db',

    options: {
      useNewUrlParser: true, // removes a deprecation warning when connecting
      useUnifiedTopology: true, // removes a deprecation warning when connecting
    },
  },

  // The migrations dir, can be an relative or absolute path. Only edit this when really necessary.
  // migrationsDir: 'migrations',

  // The mongodb collection where the applied changes are stored. Only edit
  // this when really necessary.
  // changelogCollectionName: 'changelog',

  // The file extension to create migrations and search for in migration dir
  migrationFileExtension: '.js',
}));

// Return the config as a promise
module.exports = config;

migrations directory: empty (no files, I tried with one also but same result)

When I run:

$ npx migrate-mongo status                                                                                                                                                                                   
ERROR: collection name must be a String

I have the same result whatever migrate-mongo command I run.

vladoro commented 3 years ago

Actually, if you uncomment the following line in the commit:

// changelogCollectionName: 'changelog',

then it works.