-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdb.js
More file actions
51 lines (32 loc) · 924 Bytes
/
db.js
File metadata and controls
51 lines (32 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import mongoose from "mongoose";
const Schema = mongoose.Schema;
const User = new Schema({
name : String,
email : {type : String,unique : true},
password : String,
age : Number,
})
const Admin = new Schema({
name : String,
email : {type : String,unique : true},
password : String,
age : Number,
})
const Course = new Schema({
creatorId : Schema.ObjectId,
title : String,
description : String,
price : Number,
imageUrl : String,
})
const Purchase = new Schema({
name : String,
courseId : Schema.ObjectId,
userId : Schema.ObjectId,
})
//Course content ka ek aur table bhi banasakte ho aap.
const UserModel = mongoose.model("UserModel",User)
const AdminModel = mongoose.model("AdminModel",Admin)
const CourseModel = mongoose.model("CourseModel",Course)
const PurchasesModel = mongoose.model("PurchasesModel",Purchase)
export {UserModel,AdminModel,CourseModel,PurchasesModel}