Serinus Shared Schemas
Serinus Health private schema for shared types in Mongoose.
Installation
$ npm install --save @serinus/schemas-shared
In Node.js:
const mongoose = require('mongoose')
require('mongoose-schema-jsonschema')(mongoose)
const { Schema } = mongoose
const { AddressType, PhoneType } = require('@serinus/schemas-shared')
const SampleSchema = new Schema({
name: {
type: String,
},
phones: {
type: [PhoneType],
default: undefined,
required: [true, 'sample/phones'],
},
addresses: {
type: [AddressType],
default: undefined,
required: [true, 'sample/addresses'],
},
})