diff --git a/lib/utils.js b/lib/utils.js index 9af4b12727..b7ed4ec042 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -53,6 +53,12 @@ exports.toCollectionName = function(name, pluralize) { return name; } if (typeof pluralize === 'function') { + if (typeof name !== 'string') { + throw new TypeError('Collection name must be a string'); + } + if (name.length === 0) { + throw new TypeError('Collection name cannot be empty'); + } return pluralize(name); } return name;