Skip to content

Instantly share code, notes, and snippets.

@baharalidurrani
Created November 18, 2020 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baharalidurrani/24bd92780df35238f3cd2a6ff4ca3ab8 to your computer and use it in GitHub Desktop.
Save baharalidurrani/24bd92780df35238f3cd2a6ff4ca3ab8 to your computer and use it in GitHub Desktop.
Center Model having an array of ObjectIds of Physician Models
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
import { ICenter } from 'src/types';
import { Physician } from '.';
export type CenterDocument = Center & Document;
@Schema()
export class Center implements ICenter {
@Prop()
ip: string;
@Prop()
password: string;
@Prop()
salt: string;
@Prop({ type: [Types.ObjectId], ref: Physician.name })
physicians: Physician[];
}
export const CenterSchema = SchemaFactory.createForClass(Center);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment