We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 871017c commit 04dc046Copy full SHA for 04dc046
index.js
@@ -53,12 +53,13 @@ const mongooseSlugPlugin = (schema, options = {}) => {
53
};
54
if (config.historyField) {
55
obj[config.historyField] = [
56
- {
+ {
57
type: String,
58
index: true
59
- }
+ }
60
];
61
}
62
+
63
schema.add(obj);
64
65
schema.pre('validate', async function(next) {
@@ -89,7 +90,7 @@ const mongooseSlugPlugin = (schema, options = {}) => {
89
90
91
// create slug history if it does not exist yet
92
if (!Array.isArray(this[config.historyField]))
- this[config.historyField] = [];
93
+ this[config.historyField] = [];
94
95
// add the slug to the slug_history
96
this[config.historyField].push(this[config.slugField]);
0 commit comments