Added minified URL schema as model

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2022-02-01 00:26:02 +05:30 committed by GitHub
commit 3199e8d97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import mongoose from 'mongoose';
const { Schema } = mongoose;
//build a schema
const minifiedUrlSchema = new Schema({
originalUrl: {
type: String,
required: true
},
minifiedUrl: {
type: String,
required: true
},
views: {
type: Number
},
createdAt: Number,
updatedAt: Number
});
//make a model using this schema and export it
exports.default = mongoose.model('minified_url_model', minifiedUrlSchema);