{"record":{"id":"4590a7fda8aa0573","repo":"Automattic/mongoose","slug":"collection-name-cannot-be-empty","errorCode":null,"errorMessage":"Collection name cannot be empty","messagePattern":"Collection name cannot be empty","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/utils.js","lineNumber":59,"sourceCode":" * @param {string} name a model name\n * @param {Function} pluralize function that pluralizes the collection name\n * @return {string} a collection name\n * @api private\n */\n\nexports.toCollectionName = function(name, pluralize) {\n  if (name === 'system.profile') {\n    return name;\n  }\n  if (name === 'system.indexes') {\n    return name;\n  }\n  if (typeof pluralize === 'function') {\n    if (typeof name !== 'string') {\n      throw new TypeError('Collection name must be a string');\n    }\n    if (name.length === 0) {\n      throw new TypeError('Collection name cannot be empty');\n    }\n    return pluralize(name);\n  }\n  return name;\n};\n\n/**\n * Determines if `a` and `b` are deep equal.\n *\n * Modified from node/lib/assert.js\n *\n * @param {any} a a value to compare to `b`\n * @param {any} b a value to compare to `a`\n * @return {boolean}\n * @api private\n */\n\nexports.deepEqual = function deepEqual(a, b) {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/utils.js#L41-L77","documentation":"Error \"Collection name cannot be empty\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/utils.js:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49cdab01366679723b487ecb754b38570f783289","analyzedAt":"2026-08-21T22:54:00.882Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}