intern-Assignment/Node-Assignments/URLShortener/models/url.js

20 lines
378 B
JavaScript
Raw Normal View History

2025-01-31 09:50:39 +00:00
const mongoose = require('mongoose');
const newUrl = new mongoose.Schema({
shortId: {
type: String,
require: true,
unique: true,
},
redirectURL: {
type: String,
require: true,
},
visitHistory: [{timestamps : {type: Number}}],
},
{timestamps: true}
);
const URL = mongoose.model("url", newUrl);
module.exports = URL;