Sunday 28 June 2020

Question about mongoose asyn validation

I am using mongoose and I have a problem when the async validation function, this is my code:https://pastebin.com/Dz7QLc5nBut when I pass an empty array for tags it just creates a new course with tags as an empty array like this{tags: [],date: 2020-06-28T15:53:43.379Z,_id: 5ef8bd07ec694c00dcd7bf5a,name: 'Javascript',category: 'web',author: 'mosh',isPublished: true,price: 15,__v: 0}​I tried the Promise.resolve() syntax from the documentation but it didn't work too, anyone have an idea why the validation for tags doesn't work?

Submitted June 28, 2020 at 05:14PM by Taro_Naza

No comments:

Post a Comment