13 mongoose

Post on 21-Apr-2017

77 Views

Category:

Engineering

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

MongooseAhmed Elbassel

Email: elbassel.n13@gmail.com

Skype: ahmed_elbassel

Mongoose- What is Mongoose?- Mongoose datatypes- Creating Schema- Creating models- Connecting to MongoDB- Let’s play a little with Models - CRUD Operations- Managing schema and models as professional- Exercise- Populating Objects

- Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

1. What is Mongoose?

- Alternative:- Mongolia

Creating Schema

Creating Models

Connecting to MongoDB

Let’s play a little with models - CRUD

Managing schema and models as professional- Define schema in a separate file and

expose the model of this schema.- Create a model and add your functions that

get data from the database.

Exercise- Extend your CRUD app in express session to store the data in mongodb in a

the professional way.- Let the user schema has type and views properties:

- If the type is manager then increment the views with 1.

Populating Objects- Mongoose is lazy load by default, you have to tell it to get the nested foreign

keys.

Questions

top related