mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
49 lines
723 B
JavaScript
49 lines
723 B
JavaScript
const conn = new Mongo()
|
|
const db = conn.getDB("gohcms")
|
|
|
|
db.createCollection('articles', {
|
|
validator: {
|
|
$jsonSchema: {
|
|
required: ['content', 'date', 'id_name'],
|
|
properties: {
|
|
_id: {
|
|
bsonType: 'objectId'
|
|
},
|
|
content: {
|
|
bsonType: 'object'
|
|
},
|
|
date: {
|
|
bsonType: 'number'
|
|
},
|
|
id_name: {
|
|
bsonType: 'string',
|
|
pattern: '^.+$'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
db.createCollection('users', {
|
|
validator: {
|
|
$jsonSchema: {
|
|
required: ['email', 'password'],
|
|
properties: {
|
|
_id: {
|
|
bsonType: 'objectId'
|
|
},
|
|
email: {
|
|
bsonType: 'string'
|
|
},
|
|
password: {
|
|
bsonType: 'string'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
db.users.insertOne({
|
|
email: "root",
|
|
password: "root"
|
|
}) |