-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property indexOf
of undefined
#52
Comments
@talha-asad need your help please |
nimatrazmjo
changed the title
Slug generation is not working when using
TypeError: Cannot read property Mar 2, 2021
{update: true}
indexOf
of undefined
It works fine if I downgrade my mongoose npm version to |
This is a small bug in this package where 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: #51, but a new package was never created on npm. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: