Welcome to the JSON-stores world Telerik Software Academy Databases.

Slides:



Advertisements
Similar presentations
Windows Basic and Dynamic Disk Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator Marian Marinov CEO of 1H Ltd.
Advertisements

Hybrid or Native?! Doncho Minkov Telerik Software Academy Senior Technical Trainer
HTML Forms, GET, POST Methods Tran Anh Tuan Edit from Telerik Academy
Make swiftly iOS development Telerik Academy Telerik Academy Plus.
Amazon S 3, App Engine Blobstore, Google Cloud Storage, Azure Blobs Svetlin Nakov Telerik Software Academy academy.telerik.com.
RPN and Shunting-yard algorithm Ivaylo Kenov Telerik Software Academy academy.telerik.com Technical Assistant
Shortest paths in edge-weighted digraph Krasin Georgiev Technical University of Sofia g.krasin at gmail com Assistant Professor.
Telerik Software Academy Telerik School Academy.
Asynchronous Programming with C# and WinRT
Unleash the Power of JavaScript Tooling Telerik Software Academy End-to-end JavaScript Applications.
Telerik School Academy ASP.NET MVC.
Character sequences, C-strings and the C++ String class, Working with Strings Learning & Development Team Telerik Software Academy.
Hybrid or Native?! Doncho Minkov Telerik Software Academy Senior Technical Trainer
Done already for your convenience! Telerik School Academy Unity 2D Game Development.
Processing Sequences of Elements Telerik School Academy C# Fundamentals – Part 1.
With Mocha and Karma Telerik Academy Telerik Software Academy.
C# Fundamentals – Part I
NoSQL Concepts, Redis, MongoDB, CouchDB
The Business Plan and the Business Model Margarita Antonova Volunteer Telerik Academy academy.telerik.com Business System Analyst Telerik Corporation.
What are ADTs, STL Intro, vector, list, queue, stack Learning & Development Team Telerik Software Academy.
Making JavaScript code by template! Learning & Development Team Telerik Software Academy.
Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training Who, What, Why?
Svetlin Nakov Telerik Software Academy Manager Technical Training
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Accessing SQL Server and MySQL – Live Demo Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Learning & Development Telerik Software Academy.
Telerik Software Academy ASP.NET Web Forms.
Classical OOP in JavaScript Classes and stuff Telerik Software Academy
Using Selenium for Mobile Web Testing Powered by KendoUI Telerik QA Academy Atanas Georgiev Senior QA Engineer KendoUI Team.
NoSQL Concepts, Redis, MongoDB, CouchDB Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
New features: classes, generators, iterators, etc. Telerik Academy Plus JavaScript.Next.
Throwing and Catching Exceptions Tran Anh Tuan Edit from Telerik Software Academy
Using MongoDB with.NET Welcome to the JSON-stores world SoftUni Team Technical Trainers Software University
Loops, Conditional Statements, Functions Tran Anh Tuan Edit from Telerik Academy
Telerik Software Academy ASP.NET Web Forms.
Private/Public fields, Module, Revealing Module Learning & Development Team Telerik Software Academy.
Building Data-Driven ASP.NET Web Forms Apps Telerik Software Academy ASP.NET Web Forms.
Course Introduction Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Nikolay Kostov Telerik Software Academy Senior Software Developer and Trainer
Telerik Software Academy End-to-end JavaScript Applications.
Planning and Tracking Software Quality Yordan Dimitrov Telerik Corporation Team Leader, Team Pulse, Team Leader, Team Pulse, Telerik Corporation,
What you need to know Ivaylo Kenov Telerik Corporation Telerik Academy Student.
Data binding concepts, Bindings in WinJS George Georgiev Telerik Software Academy academy.telerik.com Technical Trainer itgeorge.net.
Pavel Kolev Telerik Software Academy Senior.Net Developer and Trainer
Objects, Properties, Primitive and Reference Types Learning & Development Team Telerik Software Academy.
ORM Concepts, Entity Framework (EF), DbContext
When and How to Refactor? Refactoring Patterns Alexander Vakrilov Telerik Corporation Senior Developer and Team Leader.
Free Training and Job for Software Engineers Svetlin Nakov, PhD Manager Technical Training Telerik Corp. Telerik Software Academy.
Free Training and Job for Software Engineers Svetlin Nakov, PhD Manager Technical Training Telerik Corp. Telerik Software Academy.
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Doing the Canvas the "easy way"! Learning & Development Telerik Software Academy.
.NET Cloud Development Made Easy George Georgiev Telerik Software Academy academy.telerik.com Technical Trainer 1.
Creating and Running Your First C# Program Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Course Overview Doncho Minkov Telerik Software Academy Technical Trainer
Data Types, Primitive Types in C++, Variables – Declaration, Initialization, Scope Telerik Software Academy academy.telerik.com Learning and Development.
The past, the present, the future Learning & Development Team Telerik Software Academy.
Connecting, Queries, Best Practices Tran Anh Tuan Edit from Telerik Software Academy
Processing Sequences of Elements Telerik Software Academy C# Fundamentals – Part 2.
Telerik JavaScript Framework Telerik Software Academy Hybrid Mobile Applications.
Telerik Software Academy Databases.
Things start to get serious Telerik Software Academy JavaScript OOP.
Learning & Development Mobile apps for iPhone & iPad.
Processing Matrices and Multidimensional Tables Telerik Software Academy C# Fundamentals – Part 2.
Nikolay Kostov Telerik Software Academy academy.telerik.com Team Lead, Senior Developer and Trainer
Functions and Function Expressions Closures, Function Scope, Nested Functions Telerik Software Academy
Implementing Control Logic in C# Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical trainer
Mocking tools for easier unit testing Telerik Software Academy High Quality Code.
What why and how? Telerik School Academy Unity 2D Game Development.
Windows Security Model Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator
Presentation transcript:

Welcome to the JSON-stores world Telerik Software Academy Databases

 MongoDB overview  Installation and drivers  Structure and documents  Hosting locally MongoDB  DB Viewers  Console CLI, UMongo, Mongo VUE  Queries

 MongoDB is an open-source document store database  Save JSON-style objects with dynamic schemas  Support for indices  Has document-based queries  CRUD operations

 Download MongoDB from the official web site:   Installers for all major platforms  When installed, MongoDB needs a driver to be usable with a specific platform  One for.NET, another for Node.JS, etc…  To install the MongoDB driver for.NET run in Visual Studio's Package Manager Console Install-Package mongocsharpdriver

Live Demo

 Once installed, the MongoDB must be started  Go to installation folder and run mongod $ cd path/to/mondodb/installation/folder $ mondgod  Or add the path to mongod.exe to the %PATH%  And simply run  When run, the MongoDB can be used from.NET, Node.js, etc… $ mondgod

 Host the MongoDB instance  The C# driver for MongoDB provides a.NET SDK for working with MongoDB  Init a MongoClient with a connection string MongoClient client = new MongoClient("mongodb://localhost); MongoServer server = client.GetServer();  Connect to a database  If the db does not exists, it will be createad MongoDatabase db = server.GetDatabase("logger");  Work with the database

Live Demo

 MongoDB is an open-source DB system  So there are many available viewers  Some, but not all are:  MongoDB CLI  Comes with installation of MongoDB  Execute queries inside the CMD/Terminal  MongoVUE & UMongo  Provide UI to view, edit are remove DB documents

Live Demo

How is the data structured in MongoDB

 A MongoDB instance can have many databases  A database can have many collections  A collection can have many documents MongoDB Instance Database Collection Document Database Collection Document

 Documents in MongoDB are JSON objects Name: Databases Students: 250 Titles: - Intro to SQL - NoSQL databases - Entity Framework Evaluation: - Homework: 10 - Exam: 60 - Teamwork: 20 - Attendance: 10 {"name": "Databases", "students": 250, "students": 250, "titles": [ "titles": [ "Intro to SQL", "Intro to SQL", "NoSQL databases", "NoSQL databases", "Entity Framework" "Entity Framework" ], ], "evaluation": { "evaluation": { "homework": 10, "homework": 10, "exam": 60, "exam": 60, "teamwork": 20, "teamwork": 20, "attendance": 10 "attendance": 10}

 MongoDB documents many types of values  Numbers, Booleans  Strings, ObjectIds  Dates  Objects  Also know as nested documents  Arrays 17, 3.14, true/false "Doncho Minkov" T14:58:48.126Z { "username": "Minkov", "username": "Minkov", "accessLvl": 2 "accessLvl": 2} ['bananas', 'oranges']

 The.NET driver provides a SDK to work with MongoDB databases  Supports CRUD operations  create, read, update and delete  Can create indexes  Provides LINQ-like functionality  That is executed over the database using the native query commands  Does not have transactions  Still has atomicity on single document

Insert, Remove, Update, Get

 A collection must be created/fetched  Before performing any operations var logsCollection = db.GetCollection ("logs");  All operations are done over this collection:  Fetch documents logsCollection.FindAll();logs.FindOneById(id);  Insert  Remove logsCollection.Insert(log); logs.Remove(removeQuery);  Update logsCollection.Update( query, update); query, update);

Live Demo

Perform Operations over the Database

 MongoDB supports document-based queries  They are executed on the server  They are the equivalent of SQL for RDBMS  Queries can be made in two ways:  Using native-like MongoDB queries  Using LINQ-like queries

 Find queries are created using similar to the native MongoDB document queries:  Find recent logs: IMongoQuery findNewLogsQuery = Query.And(Query.GT("LogDate", date)); Query.And(Query.GT("LogDate", date)); var logs = logsCollection.Find(findNewLogsQuery);  Remove logs, older than a day: IMongoQuery findOldLogsQuery = Query.And( Query.LT("LogDate", Date.now.addDays(-1))); Query.LT("LogDate", Date.now.addDays(-1)));logsCollection.Remove(findOldLogsQuery);

Live Demo

 LINQ-like Queries: var findRecentBugsQuery = Query.Where(log => log.LogType.Type == "bug" && Query.Where(log => log.LogType.Type == "bug" && log.LogDate > date); log.LogDate > date); var logs = logsCollection.Find(findRecentBugsQuery).Select(log => log.Text);.Select(log => log.Text); var findOldPendingBugsQuery = Query.Where( log => log.LogDate log.LogDate < DateTime.Now.AddDays(-10) && log.LogType.Type == "bug" && log.LogType.Type == "bug" && log.LogType.State == "pending"); log.LogType.State == "pending");

Live Demo

 The MongoDB C# driver supports part of LINQ over MongoDB collections  Only LINQ queries that can be translated to an equivalent MongoDB query are supported  Others throw runtime exception and the error message will indicate which part of the query wasn’t supported var logs = from log in db.GetCollection ("Logs").AsQueryable () from log in db.GetCollection ("Logs").AsQueryable () where log.LogType.Type == "ticket" && where log.LogType.Type == "ticket" && log.LogType.State == "pending" log.LogType.State == "pending" select log;

Live Demo

форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен 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# Николай Костов - блог за програмиране

1. Research how to create a MongoDB database in Mongolab( ) 2. Create a chat database in MongoLab  The database should keep messages  Each message has a text, date and an embedded field user  Users have username

3. Create a Chat client, using the Chat MongoDB database  When the client starts, it asks for username  Without password  Logged-in users can see  All posts, since they have logged in  History of all posts  Logged-in users can post message  Create a simple WPF application for the client