diff --git a/lib/schema.ts b/lib/schema.ts index 636e91f..731dab6 100644 --- a/lib/schema.ts +++ b/lib/schema.ts @@ -12,12 +12,12 @@ const schema = new Schema({ } }) -schema.path('url').validate(async function(value) { +schema.path('urls').validate(async function(value) { const count = await models.URL.countDocuments({ url: value }) return !count }, 'URL already exists') -const URLModel = model('URL', schema) +const URLModel = model('urls', schema) export = URLModel