You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We realize that the plugin uniqueValidator is not executed:
import{SUPPORTED_LANGUAGES}from'@config/supported-languages';importuniqueValidatorfrom'mongoose-unique-validator';import{BaseSchema,extendSchema}from'monguito';exportconstSomeSchema=extendSchema(BaseSchema,{title: Object.fromEntries(SUPPORTED_LANGUAGES.map((langData)=>[langData.id,{type: String,required: false}])),externalId: {type: String,required: true,// This is not working unique: true},},{timestamps: true});// This is not workingSomeSchema.plugin(uniqueValidator);
When calling the save function of Monguito it is saved even if the externalId already exists. I do not know if it is a problem when using the extendSchema no longer allows plugins like mongoose-unique-validator or if it is something else the problem. Any idea?
That's a bug 🐛. I will fix it by including a new property plugins in the options parameter of the extendSchema utility function. This new property will enable monguito developers to specify an array of plugins they want to register in the schema resulting from the execution of the function. New release coming soon! 🎁
We realize that the plugin
uniqueValidator
is not executed:When calling the
save
function of Monguito it is saved even if theexternalId
already exists. I do not know if it is a problem when using the extendSchema no longer allows plugins likemongoose-unique-validator
or if it is something else the problem. Any idea?Originally posted by @aralroca in #219
The text was updated successfully, but these errors were encountered: