21
NoSQL Databases and MongoDB Welcome to the JSON-stores world Insert a Picture Here Learning & Development http://academy.telerik.com Telerik Software Academy

Welcome to the JSON-stores world Learning & Development Telerik Software Academy

  • View
    221

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

NoSQL Databases and MongoDB

Welcome to the JSON-stores world

Insert a Picture Here

Learning & Developmenthttp://academy.telerik.com

Telerik Software Academy

Page 2: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Table of Contents Database Systems

Relational and No-relational Databases

NoSQL Databases MongoDB

Installing MongoDB Drivers Creating and Hosting MongoDB

Locally and in the cloud

MongoDB Viewers

Page 3: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Table of Contents (2)

MongoDB and Node.js Opening connections to MongoDB

from Node.js

CRUD operations with Node.js

Querying MongoDB Documents using Node.js

Page 4: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Database Systems

Page 5: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Database Systems

by Google

Page 6: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Databases Systems(2)

A database is a storage where information can be stored Information meaning computer

information like numbers and strings

Two common types of database systems Relational databases and Non-

relational databases

Page 7: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Relational Databases Relational Database Management Systems or RDBMS Contain a set of connected tables

Tables have relations between one another

Tables have fixed table schema The saved data is in strongly-defined

format

RDBMS store normalized data RDBMS have a database language

for making CRUD and queries to the database MySQL, T-SQL, etc…

Page 8: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Non-relational Databases

Non-relational Database Management Systems or NoSQL Include fast key-value stores and

document-oriented databases (DOD)

Contain a set of documents

Documents have no fixed schema Records in a document can store

different data

Store denormalized data

Page 9: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

NoSQL Databases

Page 10: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

NoSQL Databases NoSQL databases save data in non-relational way The data is stored in many

documents

Records in a document can be different

Documents can have nested documents

NoSQL databases provide simplicity of design and availability

Used mostly when in need to keep big data or in real-time web apps

Page 11: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

MongoDB

Page 12: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

MongoDB

MongoDB is an open-source document database Save JSON-style objects with

dynamic schemas

Support for indices

Has document-based queries CRUD operations

Page 13: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Using MongoDB Download MongoDB from the official web site: https://

www.mongodb.org/downloads

Installers for all major platforms

When installed, MongoDB needs a driver to be usable with a specific platform One to use with Node.js, another to

use with .NET, etc…

Installing MongoDB driver for Node.js:

$ npm install mongodb -g

Page 14: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Installing MongoDBLive Demo

Page 15: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Working with MongoDB from Node.js

Once installed, the MongoDB must be started Go to installation folder and run mongod

$ cd path/to/mondodb/installation/folder$ mondgod

Or add mongod.exe to the PATH When run, the MongoDB can be used

from Node.js

Page 16: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Create a server to host the database

Creating MongoDB Database

The database is created using Node.js The 'mongodb' module is requiredvar mongodb = require('mongodb');

var server = new mongodb.Server('localhost', 27017); Create mongodb client that connects

to the servervar mongoClinet = new mongodb.MongoClient(server);

Open connection to the mongodb servermongoClient.open(function(err, client){

var db = client.db('DATABASE_NAME'); //queries over the db});

Page 17: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Creating aMongoDB Database

Live Demo

Page 18: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Queries over MongoDB with

Node.js

Page 19: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Queries over MongoDB with Node.js

MongoDB module supports all kinds of queries over the data Creating new documents

And adding records

Editing existing documents And their records

Removing documents and records

Querying whole documents or parts of them

Page 20: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

Node.js and MongoDB

Live Demo

Page 21: Welcome to the JSON-stores world Learning & Development  Telerik Software Academy

форум програмиране, форум уеб дизайнкурсове и уроци по програмиране, уеб дизайн – безплатно

програмиране за деца – безплатни курсове и уроцибезплатен SEO курс - оптимизация за търсачки

уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop

уроци по програмиране и уеб дизайн за ученициASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC

безплатен курс "Разработка на софтуер в cloud среда"

BG Coder - онлайн състезателна система - online judge

курсове и уроци по програмиране, книги – безплатно от Наков

безплатен курс "Качествен програмен код"

алго академия – състезателно програмиране, състезания

ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NETкурсове и уроци по програмиране – Телерик академия

курс мобилни приложения с iPhone, Android, WP7, PhoneGap

free C# book, безплатна книга C#, книга Java, книга C#Дончо Минков - сайт за програмиранеНиколай Костов - блог за програмиранеC# курс, програмиране, безплатно

?

? ? ??

?? ?

?

?

?

??

?

?

? ?

Questions?

?

NoSQL Databases and MongoDB

http://schoolacademy.telerik.co

m