Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Defining a Media model

We will implement a Mongoose model to define a Media model for storing the details of each piece of media that's posted to the application. This model will be defined in server/models/media.model.js, and the implementation will be similar to other Mongoose model implementations we covered in the previous chapters, such as the Course model we defined in Chapter 6, Building a Web-Based Classroom Application. The Media schema in this model will have fields to record the media title, description, genre, number of views, dates of when the media was posted and updated, and a reference to the user who posted the media. The code for defining the media fields is as follows:

  • Media title: The title field is declared to be of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content