Update schema.ts
This commit is contained in:
parent
c197421ac3
commit
b84145b604
|
@ -12,12 +12,12 @@ const schema = new Schema<URL>({
|
|||
}
|
||||
})
|
||||
|
||||
schema.path('urls').validate(async function(value) {
|
||||
schema.path('url').validate(async function(value) {
|
||||
const count = await models.URL.countDocuments({ url: value })
|
||||
|
||||
return !count
|
||||
}, 'URL already exists')
|
||||
|
||||
const URLModel = model<URL>('urls', schema)
|
||||
const URLModel = model<URL>('url', schema)
|
||||
|
||||
export = URLModel
|
||||
|
|
Loading…
Reference in New Issue