For now we will be making the field fields an Object field for now, for saving the JSON of a schema.
{
"$id": "https://example.com/person.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
Also, every update of this will mean in a new version of this document type
So we will have to use the plugin for versioning. Here is the repo. Install it as a dependence.
https://github.com/saintedlama/mongoose-version
Also we need to create the following db-api methods for DocumentType
Method
Description
Returns
DocumentType.create()
Creates the document type
The created documentType
DocumentType.update( {id, documentType } )
Updates a document type
The updated documentType
DocumentType.get(id)
Gets the document type
The documentType with the id
DocumentType.list(id)
Lists the document type
A list with the paginator fields and a list of document types
required
required
required
required
For now we will be making the field
fields
an Object field for now, for saving the JSON of a schema.Also, every update of this will mean in a new version of this document type So we will have to use the plugin for versioning. Here is the repo. Install it as a dependence. https://github.com/saintedlama/mongoose-version
Also we need to create the following
db-api
methods for DocumentTypeDocumentType.create()
DocumentType.update( {id, documentType } )
DocumentType.get(id)
id
DocumentType.list(id)
DocumentType.delete(id)