19 lines
585 B
TypeScript
19 lines
585 B
TypeScript
import mongoose from "mongoose";
|
|
|
|
const matapelajaranSchema = new mongoose.Schema({
|
|
matpel: { type: String, required: true }
|
|
} , { _id: false });
|
|
|
|
const guruSchema = new mongoose.Schema({
|
|
nig: { type: String, required: true },
|
|
nama: { type: String, required: true },
|
|
jk: { type: String, required: true },
|
|
no_telpon: { type: String, required: true },
|
|
password: { type: String, default: '12345678' },
|
|
listmatapelajaran: [matapelajaranSchema]
|
|
}, {
|
|
timestamps: true,
|
|
collection: 'guru'
|
|
});
|
|
|
|
export const GuruModel = mongoose.model('Guru', guruSchema); |