This talk introduces the features of MongoDB by demonstrating how one can build a simple library application. The talk will cover the basics of MongoDB's document model, query language, and API.
Building Your First App: An Introduction to MongoDBMongoDB
This document provides an introduction to building a first application using MongoDB. It discusses key MongoDB concepts like using documents rather than tables, horizontal scalability, and flexible schemas. It then demonstrates common operations like inserting, querying, updating and indexing data using the MongoDB shell. Examples show creating collections for users, books, authors and related data for a library application and performing CRUD operations on the data.
Building Your First App: An Introduction to MongoDBMongoDB
This document provides an introduction to MongoDB and demonstrates how to build a simple library management application using MongoDB. It discusses key MongoDB concepts like documents, collections, embedded documents, and references. It shows how to insert, query, update, and index data without needing to pre-define schemas. The document builds out a sample library application data model with books, authors, and publishers collections. It demonstrates querying, updating, paging through results and linking related data between collections. Official MongoDB drivers for various languages are also briefly mentioned.
Building Your First App: An Introduction to MongoDBMongoDB
This document provides an introduction to MongoDB presented by Brandon Black. It describes MongoDB as a document database that is open source, high performance, and horizontally scalable. It stores data in flexible, JSON-like documents, rather than fixed schema tables. The document explains some key MongoDB concepts like documents, collections, indexing, queries and updating records. Examples are provided of creating sample data for a library application to demonstrate MongoDB's interactive and evolving schema.
This document provides an introduction to MongoDB and how to build a basic application using MongoDB. It discusses key MongoDB concepts like documents, collections, querying, indexing and references. It walks through creating collections for users, books, authors and publishers and inserting sample documents. It demonstrates basic CRUD operations and querying. The document suggests starting simply and letting the schema evolve as the application is built.
Building Your First App: An Introduction to MongoDBGreat Wide Open
Robert Stam gave an introduction to MongoDB and building the first app. He discussed that MongoDB is a document database that uses JSON-like documents with dynamic schemas, horizontal scaling, and high performance. He then demonstrated creating a basic library management application in MongoDB by defining entities as collections, inserting sample data, and performing queries.
This document provides an introduction to MongoDB and building a sample library management application using MongoDB. It discusses key MongoDB concepts like using documents and collections instead of tables and rows, embedding documents, indexing, and querying. Examples are given of inserting, updating, and querying book and author documents to model the library application. The document emphasizes that MongoDB allows flexible schema evolution and complex queries on nested and array data.
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...MongoDB
MongoDB’s basic unit of storage is a document. Documents can represent rich, schema-free data structures, meaning that we have several viable alternatives to the normalized, relational model. In this talk, we’ll discuss the tradeoff of various data modeling strategies in MongoDB using a library as a sample application. You will learn how to work with documents, evolve your schema, and common schema design patterns.
Back to Basics Webinar 3 - Thinking in DocumentsJoe Drumgoole
- The document discusses modeling data in MongoDB based on cardinality and access patterns.
- It provides examples of embedding related data for one-to-one and one-to-many relationships, and references for large collections.
- The document recommends considering read/write patterns and embedding objects for efficient access, while breaking out data if it grows too large.
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
The document provides instructions for installing and using MongoDB to build a simple blogging application. It demonstrates how to install MongoDB, connect to it using the mongo shell, insert and query sample data like users and blog posts, update documents to add comments, and more. The goal is to illustrate how to model and interact with data in MongoDB for a basic blogging use case.
Back to Basics Webinar 1 - Introduction to NoSQLJoe Drumgoole
The document provides information about an introductory webinar on NoSQL databases and MongoDB. It includes the webinar agenda which covers why NoSQL databases exist, the different types of NoSQL databases including key-value, column, graph and document stores, and details on MongoDB including how it uses JSON-like documents, ensures data durability through replica sets, and scales through sharding. It also advertises a follow up webinar on building a first MongoDB application and provides a registration link.
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is primarily used to transmit data between a server and web application, providing an alternative to XML. It can represent numbers, strings, ordered sequences of values (arrays), and collections of name/value pairs (objects).
This talk examines four real-world use cases for MongoDB document-based data modeling. We examine the implications of several possible solutions for each problem.
Building Your First MongoDB ApplicationTugdual Grall
This document contains slides from a presentation on using MongoDB with Java. It introduces several Java drivers and ORM libraries for MongoDB, including the MongoDB Java driver, Morphia, Spring Data MongoDB, Jongo, and Hibernate OGM. For each library, it provides brief descriptions and examples of inserting and querying data. The presenter recommends Morphia for its easy mapping and queries, Spring Data for developers already using Spring, and Jongo for those who prefer MongoDB's query language. Hibernate OGM is noted as still being under development.
MongoDB is a scalable, high-performance, open-source document database that provides dynamic queries and indexing. It aims to provide the power of relational databases with the scalability and flexibility of non-relational databases. Key features include ease of use, scaling capabilities, dynamic queries similar to SQL, and speed comparable to key-value stores while supporting rich querying like relational databases.
This document describes Realm and its core components for working with objects in Realm databases. It discusses RealmObject, RealmObjectProxy, RealmList, and RealmResults which allow defining and querying object schemas and relationships. It also covers how to import and export RealmObjects as JSON using various libraries like Gson, Moshi, Jackson, and a custom Rson library. Transactions and exporting data to storage or via email is demonstrated using the Royal wrapper library.
Relational databases are central to web applications, but they have also been the primary source of pain when it comes to scale and performance. Recently, non-relational databases (also referred to as NoSQL) have arrived on the scene. This session explains not only what MongoDB is and how it works, but when and how to gain the most benefit.
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB
In this session, we'll examine schema design insights and trade-offs using real world examples. We'll look at three example applications: building an email inbox, selecting a shard key for a large scale web application, and using MongoDB to store user profiles. From these examples you should leave the session with an idea of the advantages and disadvantages of various approaches to modeling your data in MongoDB. Attendees should be well versed in basic schema design and familiar with concepts in the morning's basic schema design talk. No beginner topics will be covered in this session.
This document provides examples of using Redis data structures to solve common data modeling problems. It discusses using Redis lists to improve logging performance, hashes to track daily visitor counts, JSON to implement shopping carts, sets for tracking likes on posts, and bits to count unique daily visitors at scale. Pipelines, Lua scripting, and read replicas are proposed to further optimize some solutions.
Indexing in MongoDB works similarly to indexing in relational databases. An index is a data structure that can make certain queries more efficient by maintaining a sorted order of documents. Indexes are created using the ensureIndex() method and take up additional space and slow down writes. The explain() method is used to determine whether a query is using an index.
A presentation by Aicha Khabil (Responsable IT à l'université Alger 3) done during the 11th edition of Algiers Tech Meetup on October 8th 2016, at Djezzy Training Center (Algiers)
NoSQL databases only unfold their entire strength when also embracing the their concepts regarding usage and schema design. These slides give some overview of features and concepts of MongoDB.
The document discusses HTML5 storage options such as localStorage, sessionStorage, Web SQL Database, IndexedDB, and Application Cache. It provides details on how to use each technology, including code examples and explaining use cases. It also covers current browser support and how to detect support for different storage options. The overall purpose is to explain why and how to use HTML5 storage technologies on the web.
This document discusses schema design in MongoDB. It covers topics like working with documents, evolving schemas, queries and indexes. It provides examples of modeling common patterns like inheritance, one-to-many and many-to-many relationships, and trees. It discusses embedding data versus referencing it in different collections and considerations for schema design like access patterns and data size.
The document discusses the features of document databases, key-value stores, and relational databases. It provides examples of storing and querying document data using JavaScript objects and MongoDB. It notes that document databases allow storing rich, schema-less documents and require less querying than relational databases. The presentation argues that document databases are well-suited for dynamic, flexible data like blogs and user data, and are easier to develop for than relational databases in many cases. It acknowledges tradeoffs around ACID compliance and durability in single-server setups.
Back to Basics Webinar 5: Introduction to the Aggregation FrameworkMongoDB
The document provides information about an upcoming webinar on the MongoDB aggregation framework. Key details include:
- The webinar will introduce the aggregation framework and provide an overview of its capabilities for analytics.
- Examples will use a real-world vehicle testing dataset to demonstrate aggregation pipeline stages like $match, $project, and $group.
- Attendees will learn how the aggregation framework provides a simpler way to perform analytics compared to other tools like Spark and Hadoop.
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesMongoDB
This is the fourth webinar of a Back to Basics series that will introduce you to the MongoDB database. This webinar will introduce you to the aggregation framework.
This document provides an introduction and overview of MongoDB. It discusses how MongoDB is a document-oriented database that is open source, high performance, and horizontally scalable. It provides examples of using MongoDB with the mongo shell to create, query, update and index data. Key points covered include how MongoDB uses documents rather than tables, how data can be embedded or referenced between collections, and how to perform queries, sorting, pagination and more. Official drivers are available for connecting applications to MongoDB databases from many programming languages.
This document provides an introduction to MongoDB, including what it is, its key features, and how to work with documents in the MongoDB shell. MongoDB is an open-source, document-based database that is horizontally scalable, high performance, and full featured. It uses documents similar to JSON objects which can have various data structures. The document shows how to insert, query, update, and index documents using the MongoDB shell. Examples demonstrate working with collections like users, books, and authors in a sample library application. Schemas are flexible and evolve with the application's needs.
This document discusses using MapReduce, the Aggregation Framework, and the Hadoop Connector to perform data analysis and reporting on data stored in MongoDB. It provides examples of using various aggregation pipeline stages like $match, $project, $group to filter, reshape, and group documents. It also covers limitations of the aggregation framework and how the Hadoop Connector can help integrate MongoDB with Hadoop for distributed processing of large datasets across multiple nodes.
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
The document provides instructions for installing and using MongoDB to build a simple blogging application. It demonstrates how to install MongoDB, connect to it using the mongo shell, insert and query sample data like users and blog posts, update documents to add comments, and more. The goal is to illustrate how to model and interact with data in MongoDB for a basic blogging use case.
Back to Basics Webinar 1 - Introduction to NoSQLJoe Drumgoole
The document provides information about an introductory webinar on NoSQL databases and MongoDB. It includes the webinar agenda which covers why NoSQL databases exist, the different types of NoSQL databases including key-value, column, graph and document stores, and details on MongoDB including how it uses JSON-like documents, ensures data durability through replica sets, and scales through sharding. It also advertises a follow up webinar on building a first MongoDB application and provides a registration link.
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is primarily used to transmit data between a server and web application, providing an alternative to XML. It can represent numbers, strings, ordered sequences of values (arrays), and collections of name/value pairs (objects).
This talk examines four real-world use cases for MongoDB document-based data modeling. We examine the implications of several possible solutions for each problem.
Building Your First MongoDB ApplicationTugdual Grall
This document contains slides from a presentation on using MongoDB with Java. It introduces several Java drivers and ORM libraries for MongoDB, including the MongoDB Java driver, Morphia, Spring Data MongoDB, Jongo, and Hibernate OGM. For each library, it provides brief descriptions and examples of inserting and querying data. The presenter recommends Morphia for its easy mapping and queries, Spring Data for developers already using Spring, and Jongo for those who prefer MongoDB's query language. Hibernate OGM is noted as still being under development.
MongoDB is a scalable, high-performance, open-source document database that provides dynamic queries and indexing. It aims to provide the power of relational databases with the scalability and flexibility of non-relational databases. Key features include ease of use, scaling capabilities, dynamic queries similar to SQL, and speed comparable to key-value stores while supporting rich querying like relational databases.
This document describes Realm and its core components for working with objects in Realm databases. It discusses RealmObject, RealmObjectProxy, RealmList, and RealmResults which allow defining and querying object schemas and relationships. It also covers how to import and export RealmObjects as JSON using various libraries like Gson, Moshi, Jackson, and a custom Rson library. Transactions and exporting data to storage or via email is demonstrated using the Royal wrapper library.
Relational databases are central to web applications, but they have also been the primary source of pain when it comes to scale and performance. Recently, non-relational databases (also referred to as NoSQL) have arrived on the scene. This session explains not only what MongoDB is and how it works, but when and how to gain the most benefit.
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB
In this session, we'll examine schema design insights and trade-offs using real world examples. We'll look at three example applications: building an email inbox, selecting a shard key for a large scale web application, and using MongoDB to store user profiles. From these examples you should leave the session with an idea of the advantages and disadvantages of various approaches to modeling your data in MongoDB. Attendees should be well versed in basic schema design and familiar with concepts in the morning's basic schema design talk. No beginner topics will be covered in this session.
This document provides examples of using Redis data structures to solve common data modeling problems. It discusses using Redis lists to improve logging performance, hashes to track daily visitor counts, JSON to implement shopping carts, sets for tracking likes on posts, and bits to count unique daily visitors at scale. Pipelines, Lua scripting, and read replicas are proposed to further optimize some solutions.
Indexing in MongoDB works similarly to indexing in relational databases. An index is a data structure that can make certain queries more efficient by maintaining a sorted order of documents. Indexes are created using the ensureIndex() method and take up additional space and slow down writes. The explain() method is used to determine whether a query is using an index.
A presentation by Aicha Khabil (Responsable IT à l'université Alger 3) done during the 11th edition of Algiers Tech Meetup on October 8th 2016, at Djezzy Training Center (Algiers)
NoSQL databases only unfold their entire strength when also embracing the their concepts regarding usage and schema design. These slides give some overview of features and concepts of MongoDB.
The document discusses HTML5 storage options such as localStorage, sessionStorage, Web SQL Database, IndexedDB, and Application Cache. It provides details on how to use each technology, including code examples and explaining use cases. It also covers current browser support and how to detect support for different storage options. The overall purpose is to explain why and how to use HTML5 storage technologies on the web.
This document discusses schema design in MongoDB. It covers topics like working with documents, evolving schemas, queries and indexes. It provides examples of modeling common patterns like inheritance, one-to-many and many-to-many relationships, and trees. It discusses embedding data versus referencing it in different collections and considerations for schema design like access patterns and data size.
The document discusses the features of document databases, key-value stores, and relational databases. It provides examples of storing and querying document data using JavaScript objects and MongoDB. It notes that document databases allow storing rich, schema-less documents and require less querying than relational databases. The presentation argues that document databases are well-suited for dynamic, flexible data like blogs and user data, and are easier to develop for than relational databases in many cases. It acknowledges tradeoffs around ACID compliance and durability in single-server setups.
Back to Basics Webinar 5: Introduction to the Aggregation FrameworkMongoDB
The document provides information about an upcoming webinar on the MongoDB aggregation framework. Key details include:
- The webinar will introduce the aggregation framework and provide an overview of its capabilities for analytics.
- Examples will use a real-world vehicle testing dataset to demonstrate aggregation pipeline stages like $match, $project, and $group.
- Attendees will learn how the aggregation framework provides a simpler way to perform analytics compared to other tools like Spark and Hadoop.
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesMongoDB
This is the fourth webinar of a Back to Basics series that will introduce you to the MongoDB database. This webinar will introduce you to the aggregation framework.
This document provides an introduction and overview of MongoDB. It discusses how MongoDB is a document-oriented database that is open source, high performance, and horizontally scalable. It provides examples of using MongoDB with the mongo shell to create, query, update and index data. Key points covered include how MongoDB uses documents rather than tables, how data can be embedded or referenced between collections, and how to perform queries, sorting, pagination and more. Official drivers are available for connecting applications to MongoDB databases from many programming languages.
This document provides an introduction to MongoDB, including what it is, its key features, and how to work with documents in the MongoDB shell. MongoDB is an open-source, document-based database that is horizontally scalable, high performance, and full featured. It uses documents similar to JSON objects which can have various data structures. The document shows how to insert, query, update, and index documents using the MongoDB shell. Examples demonstrate working with collections like users, books, and authors in a sample library application. Schemas are flexible and evolve with the application's needs.
This document discusses using MapReduce, the Aggregation Framework, and the Hadoop Connector to perform data analysis and reporting on data stored in MongoDB. It provides examples of using various aggregation pipeline stages like $match, $project, $group to filter, reshape, and group documents. It also covers limitations of the aggregation framework and how the Hadoop Connector can help integrate MongoDB with Hadoop for distributed processing of large datasets across multiple nodes.
The document provides an overview of schema design in MongoDB. It discusses topics like basic data modeling, manipulating data, and evolving schemas over time. It also covers common data modeling patterns such as single table inheritance, one-to-many, many-to-many, and tree structures. The document compares MongoDB's flexible schema approach to relational databases and discusses concepts like normalization, collections, embedded documents, and indexing.
The document discusses MongoDB, an open-source document database. It provides an introduction to MongoDB, describing how it is implemented in C++ for performance and supports many platforms and languages. It also discusses how MongoDB is adopted by over 90,000 users per month with over 1,000 production deployments, and how it provides a non-relational data model with horizontal scalability and no complex transactions.
This document provides an overview of MongoDB and how it compares to traditional RDBMS systems. It discusses key concepts like how MongoDB uses JSON-like documents with flexible schemas rather than rigid tables. It also covers CRUD operations, indexing, replication, and how data is stored and queries in MongoDB compared to SQL.
This document provides an overview of building an app using Perl and MongoDB. It discusses what MongoDB is and its key features. It describes the modules needed from CPAN to interface with MongoDB from Perl. It outlines the structure of a sample "Library" app to demonstrate CRUD operations on books, authors, and other entities. The document walks through building this app and interacting with MongoDB documents and collections. It provides resources to learn more about MongoDB and the MongoDB Perl API.
The document discusses MongoDB, a non-relational database that uses documents with a flexible schema rather than tables, and is well-suited for applications that need to store data in complex, nested structures. It provides an overview of key MongoDB concepts like collections, queries, indexing, updating documents, and aggregation capabilities. Examples are given of how MongoDB can be used for applications involving user profiles, blogs, and logging.
One of the challenges that comes with moving to MongoDB is figuring how to best model your data. While most developers have internalized the rules of thumb for designing schemas for RDBMSs, these rules don't always apply to MongoDB. The simple fact that documents can represent rich, schema-free data structures means that we have a lot of viable alternatives to the standard, normalized, relational model. Not only that, MongoDB has several unique features, such as atomic updates and indexed array keys, that greatly influence the kinds of schemas that make sense. Understandably, this begets good questions: Are foreign keys permissible, or is it better to represent one-to-many relations withing a single document? Are join tables necessary, or is there another technique for building out many-to-many relationships? What level of denormalization is appropriate? How do my data modeling decisions affect the efficiency of updates and queries? In this session, we'll answer these questions and more, provide a number of data modeling rules of thumb, and discuss the tradeoffs of various data modeling strategies.
10gen Presents Schema Design and Data ModelingDATAVERSITY
This document provides an overview of schema design in MongoDB. It discusses topics such as:
- The goals of schema design, which include avoiding anomalies, minimizing redesign, avoiding query bias, and making use of features.
- Key terminology when comparing MongoDB to relational databases, such as using collections instead of tables and embedding/linking instead of joins.
- Examples of basic collections, documents, indexing, and query operators.
- Common schema patterns for MongoDB like embedding, normalization, inheritance, one-to-many, many-to-many, and trees.
- Use cases like time series are also briefly covered.
The document provides an agenda and overview for a presentation on schema design in MongoDB. Some key points include:
- Discussing common patterns for modeling one-to-one, one-to-many, and many-to-many relationships
- Examples of embedding vs. linking related data
- Considerations for schema design like data access patterns and growth
- Modeling trees and hierarchies using parent/child references
The presentation covers modeling different types of relationships and navigating tradeoffs in schema design.
MongoDB - Ruby document store that doesn't rhyme with ouchWynn Netherland
MongoDB is a document-oriented database that stores data in JSON-like documents rather than tables. It is a good fit for applications that work with unstructured or semi-structured data like content management systems and web applications. MongoDB can be accessed from Ruby applications using drivers like mongo-ruby-driver or libraries like MongoMapper that provide an ActiveRecord-like interface.
Chad Tindel's presentation covered schema design considerations for MongoDB including working with documents, evolving schemas over time, queries and indexes, and common data modeling patterns. Some key points included embedding data for performance, using references when growth is unbounded, and modeling one-to-many relationships by either embedding the related data or storing foreign keys. The presentation provided examples of modeling patrons, books, publishers, and other data to demonstrate schema patterns for trees, inheritance, and other common relationships.
The document discusses various schema design considerations for MongoDB including modeling one-to-one, one-to-many, and many-to-many relationships. It provides examples of embedding documents versus referencing them with foreign keys. Other topics covered include evolving schemas, indexing, common data patterns such as trees, and handling queues.
Robert Stam discusses schema design in MongoDB. Some key points:
- MongoDB uses collections instead of tables and documents instead of rows.
- Schema design focuses on how an application will access and use data, rather than on data storage.
- Relationships can be modeled through embedding documents, linking documents through IDs, or embedding IDs in other documents. The best approach depends on read/write patterns.
- Examples show modeling one-to-one, one-to-many, and many-to-many relationships through embedding, linking, and linking in both directions between collections.
- Categories can be modeled as documents, arrays, or hierarchical paths.
This document provides an overview and introduction to using MongoDB with Perl. It discusses how MongoDB is a document-oriented database for storing JSON objects, and how the four basic CRUD operations (create, read, update, delete) work. It also introduces the MongoDB driver for Perl and provides examples for connecting to MongoDB and performing queries, inserts, updates and deletes from Perl code. The document concludes with suggesting some coding exercises to get hands-on experience with MongoDB and Perl.
This document provides an introduction to MongoDB, including:
- MongoDB is a document-based NoSQL database that stores data in BSON format and allows indexing on any field.
- It explains the basic concepts of databases, shows how data is structured differently in relational and non-relational databases, and demonstrates some examples of MongoDB documents.
- The document then covers many MongoDB concepts like collections, documents, queries, indexes, updates, and more - providing examples for each. It is a concise yet comprehensive overview of MongoDB fundamentals.
This document discusses schema design in MongoDB. It provides examples of embedding documents versus linking between collections to model one-to-one and one-to-many relationships. Common patterns like modeling trees with parent links or arrays of ancestors are demonstrated. The document also discusses single table inheritance in MongoDB by storing different types of documents in a single collection.
MongoDB’s basic unit of storage is a document. Documents can represent rich, schema-free data structures, meaning that we have several viable alternatives to the normalized, relational model. In this talk, we’ll discuss the tradeoff of various data modeling strategies in MongoDB using a library as a sample application. You will learn how to work with documents, evolve your schema, and common schema design patterns.
This document discusses using symbolic computation in Perl to represent and manipulate mathematical objects like rational numbers, complex numbers, polynomials, and linear/quadratic equations. It presents examples of implementing rational numbers as ordered pairs of integers, complex numbers as ordered pairs of reals, and polynomials as ordered tuples. The key steps are to figure out the rules/properties of the mathematical objects, eliminate extraneous details, and find a representation to encode the objects as data structures that support defined arithmetic operations and algorithms. This allows performing symbolic rather than numeric computations natively in Perl.
This document discusses the history of extensibility in Perl, from early techniques using import subroutines and prototypes, to modern approaches like Devel::Declare, the keyword API, and Moops. Moops provides an easy and extensible way to define new syntax using Keyword::Simple, and was created to improve on earlier modules like MooseX::Declare by using a simpler design focused on extensibility. The document concludes by showing how Moops can be used to define a custom "setup" module that injects imports and extends the syntax, providing a cleaner way to share commonly used functions and roles.
The Perl API for the Mortally Terrified (beta)Mike Friedman
A brief introduction to get you started in working with Perl's internal API. This presentation is a work in progress.
Code samples: http://github.com/friedo/perl-api-terror
CPANci: Continuous Integration for CPANMike Friedman
The document provides a brief history of testing on CPAN from 1987 to the present. It discusses the development of the Test Anything Protocol (TAP) and CPAN Testers for testing Perl modules. It then proposes the idea of CPANci, a continuous integration system for all of CPAN that would test each distribution in isolation on virtualized environments to avoid issues with CPAN Testers. The document outlines an approach using perlbrew and cpanminus to test each distribution on fresh Perl installations of different versions.
MongoDB Schema Design: Four Real-World ExamplesMike Friedman
This document discusses different schema designs for common use cases in MongoDB. It presents four cases: (1) modeling a message inbox, (2) retaining historical data within limits, (3) storing variable attributes efficiently, and (4) looking up users by multiple identities. For each case, it analyzes different modeling approaches, considering factors like query performance, write performance, and whether indexes can be used. The goal is to help designers choose an optimal schema based on their application's access patterns and scale requirements.
Building Scalable, Distributed Job Queues with Redis and Redis::ClientMike Friedman
This document discusses using Redis and the Redis::Client Perl module to build scalable distributed job queues. It provides an overview of Redis, describing it as a key-value store that is simple, fast, and open-source. It then covers the various Redis data types like strings, lists, hashes, sets and sorted sets. Examples are given of how to work with these types using Redis::Client. The document discusses using Redis lists to implement job queues, with jobs added via RPUSH and popped via BLPOP. Benchmark results show the Redis-based job queue approach significantly outperforms using a MySQL jobs table with polling. Some caveats are provided about the benchmarks.
3. MongoDB is a ___________
database
• Document
• Open source
• High performance
• Horizontally scalable
• Full featured
4. Document Database
• Not for .PDF & .DOC files
• A document is essentially an associative array
• Document == JSON Object
• Document == Perl Hash
• Document == Python Dict
• Document == Ruby Hash
• etc.
5. Open Source
• MongoDB is an open source project
• On GitHub
• Server licensed under AGPL
• Drivers licensed under Apache
• Started & sponsored by 10gen
• Commercial licenses available
• Contributions welcome
6. High Performance
• Written in C++
• Extensive use of memory-mapped files
i.e. read-through write-through memory caching.
• Runs nearly everywhere
• Data serialized as BSON (fast parsing)
• Full support for primary & secondary indexes
• Document model = less work
8. Full Featured
• Ad Hoc queries
• Real time aggregation
• Rich query capabilities
• Geospatial features
• Support for most programming languages
• Flexible schema
18. In a relational based app
We would start by doing
schema design
19. Relational schema design
• Large ERD Diagrams
• Complex create table statements
• ORMs to map tables to objects
• Tables just to join tables together
• For this simple app we'd have 5 tables and 5 join
tables
• Lots of revisions until we get it just right
20. In a MongoDB based app
We start building our
and let the schema evolve
app
25. Querying for the user
> db.users.findOne()
{
"_id" : ObjectId("50804d0bd94ccab2da652599"),
"username" : "fred.jones",
"first_name" : "Fred",
"last_name" : "Jones"
}
26. _id
• _id is the primary key in MongoDB
• Automatically indexed
• Automatically created as an ObjectId if not
provided
• Any unique immutable value could be used
27. ObjectId
• ObjectId is a special 12 byte value
• Guaranteed to be unique across your cluster
• ObjectId("50804d0bd94ccab2da652599")
Timestamp machine PID Increment
28. Creating an author
> db.author.insert({
first_name: ’J.R.R.',
last_name: ‘Tolkien',
bio: 'J.R.R. Tolkien (1892-1973), beloved throughout the
world as the creator of The Hobbit and The Lord of the Rings, was a
professor of Anglo-Saxon at Oxford, a fellow of Pembroke
College, and a fellow of Merton College until his retirement in 1959.
His chief interest was the linguistic aspects of the early English
written tradition, but even as he studied these classics he was
creating a set of his own.'
})
29. Querying for our author
> db.author.findOne( { last_name : 'Tolkien' } )
{
"_id" : ObjectId("507ffbb1d94ccab2da652597"),
"first_name" : "J.R.R.",
"last_name" : "Tolkien",
"bio" : "J.R.R. Tolkien (1892-1973), beloved throughout the
world as the creator of The Hobbit and The Lord of the Rings, was a
professor of Anglo-Saxon at Oxford, a fellow of Pembroke College,
and a fellow of Merton College until his retirement in 1959. His chief
interest was the linguistic aspects of the early English written
tradition, but even as he studied these classics he was creating a
set of his own."
}
30. Creating a Book
> db.books.insert({
title: ‘Fellowship of the Ring, The',
author: ObjectId("507ffbb1d94ccab2da652597"),
language: 'English',
genre: ['fantasy', 'adventure'],
publication: {
name: 'George Allen & Unwin',
location: 'London',
date: new Date('21 July 1954'),
}
})
http://society6.com/PastaSoup/The-Fellowship-of-the-Ring-ZZc_Print/
32. Querying for key with
multiple values
> db.books.findOne({genre: 'fantasy'}, {title: 1})
{
"_id" : ObjectId("50804391d94ccab2da652598"),
"title" : "Fellowship of the Ring, The"
}
Query key with single value or
multiple values the same way.
34. Reach into nested values
using dot notation
> db.books.findOne(
{'publication.date' :
{ $lt : new Date('21 June 1960')}
}
)
{
"_id" : ObjectId("50804391d94ccab2da652598"),
"title" : "Fellowship of the Ring, The",
"author" : ObjectId("507ffbb1d94ccab2da652597"),
"language" : "english",
"genre" : [ "fantasy", "adventure" ],
"publication" : {
"name" : "george allen & unwin",
"location" : "London",
"date" : ISODate("1954-07-21T04:00:00Z")
}
}
35. Update books
> db.books.update(
{"_id" :
ObjectId("50804391d94ccab2da652598")},
{ $set : {
isbn: '0547928211',
pages: 432
}
})
True agile development .
Simply change how you work with
the data and the database follows
36. The Updated Book record
db.books.findOne()
{
"_id" : ObjectId("50804ec7d94ccab2da65259a"),
"author" : ObjectId("507ffbb1d94ccab2da652597"),
"genre" : [ "fantasy", "adventure" ],
"isbn" : "0395082544",
"language" : "English",
"pages" : 432,
"publication" : {
"name" : "George Allen & Unwin",
"location" : "London",
"date" : ISODate("1954-07-21T04:00:00Z")
},
"title" : "Fellowship of the Ring, The"
}
39. Adding a few more books
> db.books.insert({
title: 'Two Towers, The',
author: ObjectId("507ffbb1d94ccab2da652597"),
language: 'English',
isbn : "034523510X",
genre: ['fantasy', 'adventure'],
pages: 447,
publication: {
name: 'George Allen & Unwin',
location: 'London',
date: new Date('11 Nov 1954'),
}
})
http://society6.com/PastaSoup/The-Two-Towers-XTr_Print/
40. Adding a few more books
> db.books.insert({
title: 'Return of the King, The',
author: ObjectId("507ffbb1d94ccab2da652597"),
language: 'English',
isbn : "0345248295",
genre: ['fantasy', 'adventure'],
pages: 544,
publication: {
name: 'George Allen & Unwin',
location: 'London',
date: new Date('20 Oct 1955'),
}
})
http://society6.com/PastaSoup/The-Return-of-the-King-Jsc_Print/
43. Finding author by book
> book = db.books.findOne(
{"title" : "Return of the King, The"})
> db.author.findOne({_id: book.author})
{
"_id" : ObjectId("507ffbb1d94ccab2da652597"),
"first_name" : "J.R.R.",
"last_name" : "Tolkien",
"bio" : "J.R.R. Tolkien (1892.1973), beloved throughout the world as
the creator of The Hobbit and The Lord of the Rings, was a professor of
Anglo-Saxon at Oxford, a fellow of Pembroke College, and a fellow of
Merton College until his retirement in 1959. His chief interest was the
linguistic aspects of the early English written tradition, but even as he
studied these classics he was creating a set of his own."
}
49. MongoDB drivers
• Official Support for 12 languages
• Community drivers for tons more
• Drivers connect to MongoDB servers
• Drivers translate BSON into native types
• MongoDB shell is not a driver, but works like one
in some ways
• Installed using typical means (npm, cpan, gem,
pip)
#8: MongoDB server written in C++ and is fastWorking sets kept in memory as much as possibleAny OSFast serialization formatIndexingLow development time
#9: Replica sets for redundancySharding for query distributionShards on top of replica sets
#10: Query optimization talk (11:40 w/ Tyler Brock)Aggregation talk (4:25 w/Jeremy)Dozen 10gen-supported drivers / community driversSo where do we get MongoDB?
#11: Version numberHow are we going to work with MongoDB?
#12: mongod is the MongoDB daemonFirst figure out what a document database is