Open nimatrazmjo opened 3 years ago
@talha-asad need your help please
It works fine if I downgrade my mongoose npm version to 5.8.11
This is a small bug in this package where slugField
should be slugFields
. Below is the patch
diff --git a/node_modules/mongoose-url-slugs/index.js b/node_modules/mongoose-url-slugs/index.js
index 5e560ac..9eba3ec 100644
--- a/node_modules/mongoose-url-slugs/index.js
+++ b/node_modules/mongoose-url-slugs/index.js
@@ -212,7 +212,7 @@ module.exports = function(slugFields, options) {
if (toSlugify.length) toSlugify = toSlugify.substr(0, toSlugify.length - 1);
else toSlugify = options.undefinedVal;
} else {
- if (!doc.isSelected(slugField)) slugFieldsSelected = false;
+ if (!doc.isSelected(slugFields)) slugFieldsSelected = false;
if (doc.isModified(slugFields)) slugFieldsModified = true;
var slugPart = doc.get(slugFields, String);
if (slugPart !== undefined) toSlugify += slugPart;
It was actually fixed here: https://github.com/talha-asad/mongoose-url-slugs/pull/51, but a new package was never created on npm.
Monoose version:
When I want to enable update in slug generation it returns bellow error:
Before this, it was working, but now have the above issue