Upload 4.2

This commit is contained in:
Andrew Trieu
2023-05-31 13:09:58 +03:00
parent 5d671077f7
commit 15043bbd4b
14 changed files with 2491 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
const mongoose = require('mongoose')
const blogSchema = new mongoose.Schema({
title: String,
author: String,
url: String,
likes: Number
})
blogSchema.set('toJSON', {
transform: (document, returnedObject) => {
returnedObject.id = returnedObject._id.toString()
delete returnedObject._id
delete returnedObject.__v
}
})
module.exports = mongoose.model('Blog', blogSchema)