Code Monkey home page Code Monkey logo

warmup-week_10-day_2-mongoose's Introduction

General Assembly Logo

Warm-up for Mongoose

Objectives

By the end of this talk, developers should be able to:

  • Access and manipulate a MongoDB database from a Javascript program by using Mongoose.
  • Combine multiple Mongoose operations by using Javascript Promises.
  • Validate data for storage in MongoDB by setting up Mongoose validations.

Preparation

  1. Fork and clone this repository
  2. Create a new branch, training, for your work.
  3. Checkout to the training branch.
  4. Install dependencies with npm install.

The Exercise

Mongoose Schemas, Models, and Documents

there a file Mongoose model called 'student.js' in /modle/student.js , and load it from the app-students.js file located in the bin directory; that file will provide a command-line UI for performing CRUD on you new Student resource.

The 'action' methods in app-students.js have no content; you'll need to fill them up with code for doing CRUD on your new model.

The Schema of Students. Students have the following features:

  • firstName - (String, required)
  • lastName - (String, required)
  • grade - (Number, required)
  • age - (Number, Greater than or equal 18)
  • city - (String)

You should ensure that only reasonable values of firstName, lastName and grade allowed to be added to the database. The age should be numbers that greater than or equal to 18.

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

warmup-week_10-day_2-mongoose's People

Contributors

samidahlawi avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.