Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MongoDB.pdf

 MongoDB.pdf

Avatar for Maunash Jani

Maunash Jani

July 03, 2023
Tweet

More Decks by Maunash Jani

Other Decks in Technology

Transcript

  1. NoSQL  A NoSQL database enables storage and retrieval of

    data which is displayed in any format other than the tabular storage as used in traditional databases. It has no or lesser dependency on external table to fetch or store data.  NoSQL is especially useful in business environments as it handles requirements like: • Huge and ever-growing data • Agility in retrieving the data and serving it. • Synthesize and analyse the data or expose the data to 3rd party tool for analysis • Cater to a specific need of customer with high availability. Source: https://www.clariontech.com/blog/applications-that-work-best-with-nosql-database
  2.  Hence when business requires a very agile way of

    data handling, processing and delivery system, NoSQL is a cost-effective solution.  Data flexibility, scalability and speed are synonyms to NoSQL. NoSQL database, when methodically distributed over zones, can scale, meet the demanding hits, and provide data on the fly, apart from giving the low latency required for real time interface with your customers. Source: https://www.clariontech.com/blog/applications-that-work-best-with-nosql-database
  3. • Language  SQL databases use Structured Query Language for

    defining and manipulating data  SQL requires that you use predefined schemas to determine the structure of your data before you even begin to work with it.  A NoSQL database features a dynamic schema for unstructured data and the data can be stored in many different ways, whether it be graph-based, document-oriented, column-oriented, or organized as a KeyValue store. • Scalability  In most SQL databases, they are vertically scalable, which means that you can increase the load on a single server by increasing components like RAM, SSD, or CPU. In contrast,  NoSQL databases are horizontally scalable, which means that they can handle increased traffic simply by adding more servers to the database. • Structure  SQL databases are table-based which makes them a better option for applications that require multi-row transactions.  NoSQL databases can be key-value pairs, wide-column stores, graph databases, or document-based. Source: https://www.bmc.com/blogs/sql-vs-nosql/
  4. Example SQL CREATE TABLE students ( name varchar, class varchar

    ); NoSQL { name: “John Doe”, class: “maths” } Source: https://www.bmc.com/blogs/sql-vs-nosql/
  5.  INSERT INTO students (name, class) VALUES (“John Doe”, “maths”);

     db.students.insert( { name: “John Doe”, class: “maths” } ) Source: https://www.bmc.com/blogs/sql-vs-nosql/
  6.  Apart from this, NoSQL can easily be deployed in

    various domains such as - 1. Detecting Fraud in ecommerce - algorithm rules, client information / location, transaction information, last device usage etc. 2. Digital data, Mobile data and Communication 3. Analyses of huge unstructured data for social tracking and trends. 4. Internet of Things. (IOT) 5. Ecommerce, hotels, travel - Catalogue availability 6. Real-Time Big Data Accessibility and management. - NoSQL can be deployed at Frontend that can store and serve operational data from multi source. 7. NoSQL can also be deployed at the Backend to aggregate, store and create analysis and results.  NoSQL databases were developed in response to the sheer & random volume of data being generated each day by modern users and their applications. NoSQL enables applications to quickly process this data. Source: https://www.clariontech.com/blog/applications-that-work- best-with-nosql-database
  7.  Some major challenges that are addressed by NoSQL: •

    Twitter app generating 7 Tbs plus of daily tweets and displaying it back. • Property details in a Real-estate website, redundant in nature but accessed in huge numbers. • Online Coupon sites distributing coupons to open market. • Update of railway schedules and accessed by thousands of users at peak time. • Real time score update of baseball / cricket match.  NoSQL is an alternative to traditional database and is a more cost-friendly approach. Here the data can easily grow by distributing itself over lots of ordinary and cheap, cloud servers.  Plus, NoSQL database is exactly the type of database that can handle the sort of unstructured, spaghetti and unpredictable data (e.g. user data/tweet) that meets business requirement. Source: https://www.clariontech.com/blog/applications-that-work- best-with-nosql-database
  8.  Why should you use a NoSQL database?  NoSQL

    databases are a great fit for many modern applications such as mobile, web, and gaming that require flexible, scalable, high-performance, and highly functional databases to provide great user experiences. • Flexibility: NoSQL databases generally provide flexible schemas that enable faster and more iterative development. The flexible data model makes NoSQL databases ideal for semi-structured and unstructured data. • Scalability: NoSQL databases are generally designed to scale out by using distributed clusters of hardware instead of scaling up by adding expensive and robust servers. Some cloud providers handle these operations behind-the-scenes as a fully managed service. • High-performance: NoSQL database are optimized for specific data models and access patterns that enable higher performance than trying to accomplish similar functionality with relational databases. • Highly functional: NoSQL databases provide highly functional APIs and data types that are purpose built for each of their respective data models. Source: https://www.clariontech.com/blog/applications-that-work- best-with-nosql-database
  9. Types of NoSQL DB  Key Value: Use cases such

    as gaming, ad tech, and IoT lend themselves particularly well to the key-value data model.  Document: Data is represented often as an object or JSON-like document, e.g. catalogs, user profiles, and content management systems where each document is unique and evolves over time.  Graph: use cases for a graph database include social networking, recommendation engines, fraud detection, and knowledge graphs. Source: https://aws.amazon.com/nosql
  10. Applications  Facebook messaging platform  Apache Cassandra was created

    by Facebook to power their Inbox.  Cassandra indexed users’ messages and the terms (words, and so on) in the messages and drove a search over all the content in those messages. The user ID was the primary key. Each term became a super column, and the message IDs were the column names. Source: https://www.dummies.com/programming/big-data/nosql/10-killer-nosql-applications/
  11. Applications  Amazon DynamoDB  Amazon DynamoDB is a key-value

    and document database that delivers single-digit millisecond performance at any scale.  Many of the world's fastest growing businesses such as Lyft, Airbnb, and Redfin as well as enterprises such as Samsung, Toyota, and Capital One depend on the scale and performance of DynamoDB to support their mission-critical workloads. Source: https://www.dummies.com/programming/big-data/nosql/10-killer-nosql-applications/
  12. Applications  Google Mail  Google’s Bigtable was created to

    provide wide-column storage for a range of Google’s applications, including Orkut, Google Earth, web indexing, Google Maps, Google Books, YouTube, blogger.com, Google Code and Google Mail.  Bigtable clones provide index lookup tables for very large sets of information Source: https://www.dummies.com/programming/big-data/nosql/10-killer-nosql-applications/
  13. Applications LinkedIn  LinkedIn has used Hadoop to churn information

    about relationships overnight and to push the latest graph information to the Voldemort key-value NoSQL store for query the next day. Source: https://www.dummies.com/programming/big-data/nosql/10-killer-nosql-applications/
  14. ROW -> DOCUMENT ROW(S) -> DOCUMENT COLUMN -> FIELD TABLE

    -> COLLECTION DATABASE -> DATABASES INDEX -> INDEX JOIN -> EMBEDDING Reference: https://vimeo.com/579953271
  15. Notes  WEB TECH  1. HTML - PRESENTATION OF

    CONTENT  2. CSS - SYNTAX TO BEAUTIFY CONTENT  3. JAVASCRIPT - INTERACTING WITH WEBSITE  WEB DEVELOPMENT  1. FRONTEND - UI (Client Side)  => HTML, CSS, JS, jQuery, ... Angular  2. BACKEND - CODE + DATABASE (Server Side)  => PHP, C#, JAVA, PYTHON, Node.js (JavaScript)  => MongoDB, MySQL, MSSQL, Oracle, PostgresSQL, ...
  16. Notes  SQL - Relational DB Schema - Tabular format

    - Table - Rows, Columns, Join, Primary Key,  Forigen Key.  NoSQL - No Relational DB Schema  Document  Any format   JSON - JavaScript Object Notation   {  field: value,  field: [  field: value  ]  }
  17. Notes  select * from inventory where name = 'typewriter'

     db.inventory.find(  { "name": "typewriter"}  );  https://www.mongodb.com/   https://www.mongodb.com/cloud/atlas/register  https://cloud.mongodb.com
  18. Notes  DATABASE - CRUD operations  Create, Read, Update,

    Delete  { "marks": 70 }  marks > 70  { "marks": { $gt : 70 } }  marks <80   { "marks": { $lt : 80 } }
  19. Notes  https://www.mongodb.com/docs/manual/reference/operator/query/regex/   select * from students where

    name like 'jo%'   { "name": { $regex: "^jo" } }  regex - regular expressions/patterns  https://www.mongodb.com/docs/drivers/node/current/usage-examples/  MongoDB Compass   https://github.com/maunashjani/Node.js-Workshop