-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.js
More file actions
37 lines (33 loc) · 685 Bytes
/
model.js
File metadata and controls
37 lines (33 loc) · 685 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
'use strict'
const mongoose = require('mongoose');
var userExercisesSchema = new mongoose.Schema({
_id: {
type: String,
required: true
},
username: {
type: String,
required: true,
index: {unique: true},
maxlength: [20,'Too long Name!']
},
log: [{
description: {
type: String,
require: true,
maxlength: [20,'Too long Description!']
},
duration: {
type: Number,
required: true,
min: [1,'Duration should be atleast 1 min']
},
date: {
type: Date,
default: Date.now
},
__v: false,
_id: false
}]
});
module.exports = mongoose.model('users',userExercisesSchema);