jocoso / Book-Club

A website for books enthusiast
https://book-club-8svz.onrender.com
0 stars 0 forks source link

Create Comment Model #32

Closed AhmedGarcia closed 1 month ago

AhmedGarcia commented 1 month ago

Define the following fields in the Comment schema: title: String (Required) - Title of the comment. content: String - Content of the comment. author: Schema.Types.ObjectId (Reference to User, Required) - User who authored the comment. blob: Number (Default: 0) - Additional metadata field for future use. Schema Options:

Enable toJSON virtuals for the schema to transform the document data when serialized. Create Model:

Use mongoose.model() to create the Comment model from the schema. Export Model:

Export the Comment model for use in other parts of the application.

AhmedGarcia commented 1 month ago

completed