Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Schema = require('mongoose').Schema;
- // Each contact type has it's own schema
- const CallSchema = require('./call');
- const TextSchema = require('./text');
- const ChatSchema = require('./chat');
- var OrganizationSchema = new Schema(
- {
- name: {
- type: String,
- required: true
- },
- website: {
- type: String,
- required: true
- },
- // "contacts" container is required
- // along with at least one of the contact-type properties
- contacts: {
- call: { // call OR
- type: [CallSchema]
- },
- text: { // text OR
- type: [TextSchema]
- },
- chat: { // chat
- type: [ChatSchema]
- }
- }
- }
- );
- module.exports = OrganizationSchema;
Advertisement
Add Comment
Please, Sign In to add comment