-
-
Save snehil002/8a493d91acfca6ea9b346f8a0a08e12e to your computer and use it in GitHub Desktop.
Web AnalyticsTool - MongoDB Schema Design - Fields and Validations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***********Mongoose Schema*********/ | |
const sessionSchema = new Schema({ | |
"webId": { | |
type: String, | |
enum: { values: ["SUB001"], message: "{VALUE} is not Valid!" }, | |
required: [true, "Why no WEB ID?"] | |
}, | |
"currentUrlHost": { type: String, required: [true, "Why no URL Orgin?"] }, | |
"currentPagePath": { type: String, required: [true, "Why no Page Path?"] }, | |
"visiOrOpenDateTime": { type: Date, required: [true, "Why no Page Visit Date?"] }, | |
"timeOnPageInS": { | |
type: Number, | |
min: [0, "Negative time duration!"], | |
required: [true, "Why no Time Spent on Page?"] | |
}, | |
"trafficSource": { type: String, required: [true, 'Why no Traffic Source?'] }, | |
"deviceWidth": { | |
type: Number, | |
min: [100, "Screen width too small!"], | |
max: [10500, "Screen width so large!"], | |
required: [true, 'Why no Device Width?'] | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment