Improved Article model

This commit is contained in:
Florian Sylvain
2023-01-09 09:53:33 +01:00
parent 117df6914b
commit 8be0059525
4 changed files with 25 additions and 21 deletions
+10 -7
View File
@@ -4,23 +4,26 @@ const db = conn.getDB("gohcms")
db.createCollection('articles', {
validator: {
$jsonSchema: {
required: ['content', 'date', 'id_name', 'page_id', 'online'],
required: ['titleID', 'title', 'content', 'date', 'tags', 'online'],
properties: {
_id: {
bsonType: 'objectId'
},
titleID: {
bsonType: 'string',
pattern: '^[-a-z]+$'
},
title: {
bsonType: 'string'
},
content: {
bsonType: 'object'
},
date: {
bsonType: 'number'
},
id_name: {
bsonType: 'string',
pattern: '^.+$'
},
page_id: {
bsonType: 'string'
tags: {
bsonType: 'array'
},
online: {
bsonType: 'bool'