From b833e1dcd49ec1f7bd4565155733aeb9b1ae12a2 Mon Sep 17 00:00:00 2001 From: "Terence D. Honles" Date: Thu, 28 Sep 2017 11:54:47 -0700 Subject: [PATCH] filter out files which don't start with a number or have an exported id --- src/mongodb-migrations.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mongodb-migrations.coffee b/src/mongodb-migrations.coffee index ce3eb1c..a8a0275 100644 --- a/src/mongodb-migrations.coffee +++ b/src/mongodb-migrations.coffee @@ -186,12 +186,14 @@ class Migrator n = null return { number: n, name: f } .filter (f) -> !!f.name - .sort (f1, f2) -> f1.number - f2.number .map (f) -> fileName = path.join dir, f.name if fileName.match /\.coffee$/ require('coffee-script/register') - return { number: f.number, module: require(fileName) } + module = require(fileName) + return { number: f.number || module.id, module: module } + .filter (f) -> f.number? + .sort (f1, f2) -> f1.number - f2.number cb null, files runFromDir: (dir, done, progress) ->