Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to mongo db

44 views

Published on

Introduction To MongoDB Slides - Faro Dev Day, 2016

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Introduction to mongo db

  1. 1. Introduction to MongoDB Faro Dev Day 16 Mwai Karimi @openbk /kmwai
  2. 2. Agenda Intro Concepts & Rationale ● What is Mongodb, evolution, Key Features ● Internals, crud operations, data management, security, provisioning and disaster recovery
  3. 3. About me Student Web developer, tech enthusiast Ardent foodie, travel junkie Passionate about women empowerment & History
  4. 4. Concepts & Rationale ● Hardware - Parallelism (cores / servers / Cloud Computing / Distributed computing) ● Scale up -> “Big data” ● Make app dev easier & elegant ○ Complex structure, unstructured, polymorphic Scaling / dev Speed / Complex data
  5. 5. Scale Out
  6. 6. What is MongoDB • Scalable High-Performance Open-source, Document-oriented database. • Built for Speed • Rich Document based queries for easy readability. • Full Index Support for High Performance. • Replication and Failover for High Availability. • Auto Sharding for Easy Scalability. • Map / Reduce for Aggregation. Support for multiple storage engines
  7. 7. Why Documents? ● Documents (i.e. objects) correspond to native data types in many programming languages. ● Embedded documents and arrays reduce need for expensive joins. ● Dynamic schema supports fluent polymorphism.
  8. 8. Driver support C, C++, Java, PHP, Python, Node, Pearl, Ruby, Motor, Erlang
  9. 9. Internals Database - database ● Made up of multiple collections ● Created on the fly when referenced for the first time Collection - Table ● Schemaless - Contains documents ● Indexable ● Created on the fly when referenced Document - Row ● Stored in a collection ● Have _id - similar to primary keys ● Supports Relationships (embedded / referenced) ● Stored in BSON (Binary JSON)
  10. 10. internals Restrictions ● The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array. ● The field names cannot start with the dollar sign ($) character. ● The field names cannot contain the dot (.) character. ● The field names cannot contain the null character.
  11. 11. CRUD Operations Create - Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection. MongoDB provides the following methods to insert documents into a collection: ● db.collection.insert() ● db.collection.insertOne() New in version 3.2 ● db.collection.insertMany() New in version 3.2
  12. 12. CRUD Operations Read operations retrieves documents from a collection; i.e. queries a collection for documents. MongoDB provides the following methods to read documents from a collection: ● db.collection.find()
  13. 13. CRUD Operations Update operations modify existing documents in a collection. MongoDB provides the following methods to update documents of a collection: ● db.collection.update() ● db.collection.updateOne() New in version 3.2 ● db.collection.updateMany() New in version 3.2 ● db.collection.replaceOne() New in version 3.2
  14. 14. CRUD Operations Delete operations remove documents from a collection. MongoDB provides the following methods to delete documents of a collection: ● db.collection.remove() ● db.collection.deleteOne() New in version 3.2 ● db.collection.deleteMany() New in version 3.2
  15. 15. Data Management ● Auto-Sharding (sharding) - automatically balances the data in the sharded cluster as the data grows or the size of the cluster increases or decreases. ○ Range based - docs partitioned across shards according to the shard key value ○ Hash based - “ “ according to the MD5 hash of the shard key value ○ Zone Sharding - provides dba & ops teams w/ opportunities to define rules governing data placement in a sharded cluster ● Availability - through Replication (replica sets) ○ Replica failover fully automated ○ No. of replica sets fully configurable (up to 50) - allows for data durability in case of failures ○ Replica sets allow for operational flexibility - db does not need to be taken offline ○ Allows for tunable consistency - apps reading from secondaries (data is consistent by default)
  16. 16. Security ● Authentication - integration w/ LDAP, Kerberos ● Authorisation - admins can define user-based roles ● Auditing - audit log to track any op taken against the db ● Encryption - Data can be encrypted on the network, disk & in back ups
  17. 17. Provisioning, Monitoring and Disaster Recovery Made possible by the Mongodb Ops Manager ● Deployment - Any topology, at any scale ● Upgrade - In minutes, with no downtime ● Scale - Add capacity, without taking the application offline ● Visualize - Graphically display query performance to identify and fix slow running operations ● Point-in-time, Scheduled backups - restore complete running clusters to any point in time with just a few clicks, because disasters aren't predictable ● Performance Alerts - Monitor 100+ system metrics and get custom alerts before the system degrades.
  18. 18. MongoDB Atlas DB as a service Automated operations - deploy in minutes Elastic - easy to scale up or out Performance metrics in real time
  19. 19. Resources Case studies - (mongodb.com/customers) Documentation - (docs.mongodb.com) MongoDB Enterprise download - mongodb.com/download MongoDB Atlas - (mongodb.com/cloud/atlas)

×