MongoDB is the coolest NoSQL DB around, partially because it's simple-by-design philosophy. Without transactions or joins, all the bad vibe of SQL is gone.
In this presentation I demonstrate how to get started with MongoDB in the cloud using Mon
Jan Lehnardt Couch Db In A Real World SettingGeorge Ang
This document summarizes Jan Lehnardt's presentation on CouchDB. It includes the following key points:
1) Jan introduced himself as a CouchDB developer and discussed some basic benchmarks showing CouchDB's performance of 2,500 requests per second on a dual core system using only 9.8MB of RAM.
2) Views in CouchDB allow indexing and querying of document data through map-reduce functions. Examples shown include counting tags, grouping data by date, and performing reductions at different grouping levels.
3) Relationships between documents can be modeled through embedding related data in a single "parent" document or using separate "master-slave" documents with references.
4) CouchDB uses
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.
The document summarizes a presentation about scaling Pinterest's architecture. It discusses how Pinterest uses sharding across multiple MySQL databases to scale its infrastructure. Key points include how Pinterest generates IDs across shards, loads data, handles caching, and has transitioned its database structure over time to support increased load.
GAA is converting legacy SQL databases to MongoDB using its goMongo tool. goMongo allows users to identify primary and foreign keys in SQL tables and convert them to embedded arrays or linked documents in MongoDB. It also provides options to embed or link documents to preserve one-to-many and many-to-many relationships. GAA has used goMongo successfully in several of its projects including converting authentication and authorization systems from Oracle and MySQL to MongoDB.
Nosh slides mongodb web application - mongo philly 2011MongoDB
This document discusses using MongoDB for building a location-based application that allows users to check in at places and view stats about checkins. It covers data modeling places and users collections with embedded documents and references. It also covers indexing, atomic updates, map-reduce for analytics, and scaling MongoDB deployments.
The document outlines best practices for deploying MongoDB, including prototyping deployment parameters, testing performance, monitoring key metrics, scaling the setup based on monitoring data, scripting deployment processes, and continuing to monitor and improve the deployment through iterative cycles of problem diagnosis and solution implementation. The goal is to understand resource needs before deploying and avoid surprises through ongoing monitoring, analysis, and improvement of the deployment configuration.
Jan Lehnardt Couch Db In A Real World SettingGeorge Ang
This document summarizes Jan Lehnardt's presentation on CouchDB. It includes the following key points:
1) Jan introduced himself as a CouchDB developer and discussed some basic benchmarks showing CouchDB's performance of 2,500 requests per second on a dual core system using only 9.8MB of RAM.
2) Views in CouchDB allow indexing and querying of document data through map-reduce functions. Examples shown include counting tags, grouping data by date, and performing reductions at different grouping levels.
3) Relationships between documents can be modeled through embedding related data in a single "parent" document or using separate "master-slave" documents with references.
4) CouchDB uses
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.
The document summarizes a presentation about scaling Pinterest's architecture. It discusses how Pinterest uses sharding across multiple MySQL databases to scale its infrastructure. Key points include how Pinterest generates IDs across shards, loads data, handles caching, and has transitioned its database structure over time to support increased load.
GAA is converting legacy SQL databases to MongoDB using its goMongo tool. goMongo allows users to identify primary and foreign keys in SQL tables and convert them to embedded arrays or linked documents in MongoDB. It also provides options to embed or link documents to preserve one-to-many and many-to-many relationships. GAA has used goMongo successfully in several of its projects including converting authentication and authorization systems from Oracle and MySQL to MongoDB.
Nosh slides mongodb web application - mongo philly 2011MongoDB
This document discusses using MongoDB for building a location-based application that allows users to check in at places and view stats about checkins. It covers data modeling places and users collections with embedded documents and references. It also covers indexing, atomic updates, map-reduce for analytics, and scaling MongoDB deployments.
The document outlines best practices for deploying MongoDB, including prototyping deployment parameters, testing performance, monitoring key metrics, scaling the setup based on monitoring data, scripting deployment processes, and continuing to monitor and improve the deployment through iterative cycles of problem diagnosis and solution implementation. The goal is to understand resource needs before deploying and avoid surprises through ongoing monitoring, analysis, and improvement of the deployment configuration.
The document provides an overview of MongoDB, describing it as an open-source, high-performance, schema-free, document-oriented database. It then outlines some basic terms used in MongoDB like document, BSON, collection, and GridFS. The remainder of the document discusses technical aspects of MongoDB like administration, drivers, replication, sharding, and features such as queries, indexes, map reduce, and upserts. It concludes by reviewing several companies that use MongoDB successfully in production applications.
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMongoDB
The document outlines the agenda for a MongoDB conference in Paris. It introduces the presenters from 10gen and partner companies. The agenda includes introductions to NoSQL and MongoDB, technical overviews, customer and partner presentations, and a Q&A session. It also discusses how MongoDB provides an operational 'Big Data' solution and can help address the challenges of increasing data complexity, volume, and types that traditional RDBMS struggle with.
Thomas risberg mongosv-2012-spring-data-cloud-foundrytrisberg
The document discusses Spring Data and MongoDB support in Spring. It provides an overview of Spring Data and how it aims to provide a consistent programming model for both relational and non-relational data stores. It then discusses how Spring Data provides repositories and templates for working with MongoDB that abstract away low-level MongoDB APIs and allow using common Spring and Java idioms. It also provides examples of configuring MongoDB support in Spring and using Spring Data features like repositories, queries, and mapping objects to MongoDB documents.
CloudFoundry and MongoDb, a marriage made in heavenPatrick Chanezon
This talk will provide an overview of the PaaS (Platform as a Service) landscape, and will describe the Cloud Foundry open source PaaS, with its multi-framework, multi-service, multi-cloud model. Cloud Foundry allows developers to provision apps in Java/Spring, Ruby/Rails, Ruby/Sinatra, Javascript/Node, and leverage services like MySQL, MongoDB, Reddis, Postgres and RabbitMQ. It can be used as a public PaaS on CloudFoundry.com and other service providers (ActiveState, AppFog), to create your own private cloud, or on your laptop using the Micro Cloud Foundry VM. Micro Cloud Foundry is a very easy way for developers to start working on their application using their framework of choice and MongoDB, without the need to setup a development environment, and your app is one command line away (vmc push) from deployment to cloudfoundry.com.
Trisha Gee explores the deeper relationship between the MongoDB database and various languages on the Java Virtual Machine such as Java, Scala, Clojure, JRuby and Python as well as the challenges posted getting MongoDB to play nice with these tools and their syntax. Also examined will be frameworks and integration points popular between MongoDB and the JVM such as Spring Data, Morphia and Lift’s MongoDB-Record component.
This document provides an introduction and overview of MongoTalk and Voyage, two Smalltalk libraries for interacting with MongoDB databases. It demonstrates how to install, configure, and perform basic operations like creating databases and collections, inserting, updating, deleting and querying documents with both libraries. It also shows how to customize mappings and relationships when using Voyage.
This document provides an overview and introduction to MongoDB and Mongoose. It discusses how MongoDB is a document-oriented NoSQL database that stores data as JSON-like documents. It then introduces Mongoose as an object data modeling (ODM) library for MongoDB and Node.js applications that manages connections and schema. Various Mongoose concepts are explained such as schemas, models, CRUD operations, queries, validation, and plugins. The document aims to help developers get started with MongoDB and Mongoose.
This document provides an overview and introduction to MongoDB, an open-source, high-performance NoSQL database. It outlines MongoDB's features like document-oriented storage, replication, sharding, and CRUD operations. It also discusses MongoDB's data model, comparisons to relational databases, and common use cases. The document concludes that MongoDB is well-suited for applications like content management, inventory management, game development, social media storage, and sensor data databases due to its flexible schema, distributed deployment, and low latency.
This document discusses Drupal and MongoDB. It provides an overview of MongoDB as a document-oriented and schema-less database and compares its flexibility, power, speed, and scaling to relational databases. It also describes several Drupal modules that integrate MongoDB as a backend storage mechanism, including for blocks, caching, fields, sessions, queues, and search. Examples are provided of past sessions on using MongoDB with Drupal.
The document discusses the Dust templating engine and how it provides separation of presentation and logic without sacrificing ease of use. It explains that Dust uses keys in templates to reference data in JSON, sections to enumerate blocks, and helpers/partials to add logic. Helpers can be written once and support the DRY principle. Partials allow passing parameters and accessing the parent scope. The document provides examples of using helpers, partials, and JavaScript controls to dynamically render badges based on a user's connection distance and add localization.
This document summarizes an agenda for a schema design workshop. The workshop covers basic schema and patterns, schema design, sharding, and replication in MongoDB. It includes examples of schema design for relational databases and MongoDB, including embedding, linking, inheritance patterns, one-to-many relationships, and many-to-many relationships. The goals are to learn data modeling with MongoDB through labs and understand implications of replication and sharding.
This document discusses Android code templates, which use FreeMarker to generate boilerplate Android code and assets from simple UI parameters. It describes the default ADT templates, how they are located, and how to configure Eclipse to work with templates. It provides an overview of FreeMarker and demonstrates how to create a custom animation template using FreeMarker directives.
The document discusses the growth of humongous data and tools for processing it. It begins with an overview of humongous data and its exponential growth trends. MongoDB and Hadoop are presented as key tools for storing and processing large datasets, with MongoDB suitable for storage and basic operations and Hadoop useful for distributed processing. The document concludes by noting that as data sizes continue growing rapidly, new tools will be needed to analyze "big data," with MongoDB committed to integrating with tools like Hadoop, Storm, and Spark.
Moving to Dojo 1.7 and the path to 2.0James Thomas
With the upcoming 1.7 release, The Dojo Toolkit is beginning to introduce major structural and architectural changes in the toolkit, setting the path for their new major 2.0 release due in 2012.
These fundamental changes to the architecture and technologies underpinning the toolkit will dramatically change how we write Dojo applications in the future, bringing with it huge benefits in performance, cross-library compatibility and support for mobile platforms.
In this presentation, I'll be walking through these changes, explaining the benefits and how it'll impact developers. I'll also be providing migration tips to help you start taking advantage of these benefits in your application today, based upon my experience using Dojo 1.7 on the Watson project.
This talk will be technical in nature, aiming at developers and team leads who are using the toolkit in their products or on client engagements.
This document provides an overview of a presentation on acceptance and integration testing with Behat. It includes slides on setting up the testing environment with Open Box and Ubuntu, an introduction and roadmap for content covered, which includes introductions to BDD and Behat, writing Behat tests, UI testing with Mink, fixture building with Phabric, common contexts in Behat, and a case study of Behat in use. It also includes slides soliciting questions from the audience.
The document discusses a presentation about unit testing TripCase with Jasmine. It covers an overview of unit testing and what parts of an application are best suited for unit testing. It then discusses the specific challenges of unit testing TripCase and analyzes which parts of TripCase are reflexive and algorithmic and therefore good candidates for unit testing. It also covers test-driven development and includes an example of identifying unit test assertions for a hotel search story.
This document provides a summary of JavaScript DOM manipulations and events. It discusses how browsers render pages by creating DOM and render trees. It also covers how JavaScript can manipulate the DOM tree and add interactivity through event handling. Key topics include the event loop, capturing vs bubbling, and the DOM API for finding elements and modifying the document.
MongoDb that holds data in form of documents and have dynamic schema.It provides indexing ,use sharding concept by this it provides scalable environment for sharded cluster.
This document provides an overview of regular expressions (regex). It begins by stating that regex can help find patterns in text and briefly outlines the history of regex from mathematics to its introduction in Unix. It then explains that regex can be used as an alternative to shell wildcards and that many Unix tools incorporate regex. The document proceeds to list programming languages that use regex and provides some basic regex rules including matching single characters, character classes, quantifiers, and assertions. It provides examples to demonstrate matching patterns using these rules.
This document provides an overview of front-end HTML5 web development, including its history from 2004 to becoming a W3C recommendation in 2014. It discusses using new HTML5 features to build complex client-side apps and focuses on teaching attendees how to write front-end code focused on JavaScript to develop modern web applications, demonstrating examples along the way.
The document provides an overview of MongoDB, describing it as an open-source, high-performance, schema-free, document-oriented database. It then outlines some basic terms used in MongoDB like document, BSON, collection, and GridFS. The remainder of the document discusses technical aspects of MongoDB like administration, drivers, replication, sharding, and features such as queries, indexes, map reduce, and upserts. It concludes by reviewing several companies that use MongoDB successfully in production applications.
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMongoDB
The document outlines the agenda for a MongoDB conference in Paris. It introduces the presenters from 10gen and partner companies. The agenda includes introductions to NoSQL and MongoDB, technical overviews, customer and partner presentations, and a Q&A session. It also discusses how MongoDB provides an operational 'Big Data' solution and can help address the challenges of increasing data complexity, volume, and types that traditional RDBMS struggle with.
Thomas risberg mongosv-2012-spring-data-cloud-foundrytrisberg
The document discusses Spring Data and MongoDB support in Spring. It provides an overview of Spring Data and how it aims to provide a consistent programming model for both relational and non-relational data stores. It then discusses how Spring Data provides repositories and templates for working with MongoDB that abstract away low-level MongoDB APIs and allow using common Spring and Java idioms. It also provides examples of configuring MongoDB support in Spring and using Spring Data features like repositories, queries, and mapping objects to MongoDB documents.
CloudFoundry and MongoDb, a marriage made in heavenPatrick Chanezon
This talk will provide an overview of the PaaS (Platform as a Service) landscape, and will describe the Cloud Foundry open source PaaS, with its multi-framework, multi-service, multi-cloud model. Cloud Foundry allows developers to provision apps in Java/Spring, Ruby/Rails, Ruby/Sinatra, Javascript/Node, and leverage services like MySQL, MongoDB, Reddis, Postgres and RabbitMQ. It can be used as a public PaaS on CloudFoundry.com and other service providers (ActiveState, AppFog), to create your own private cloud, or on your laptop using the Micro Cloud Foundry VM. Micro Cloud Foundry is a very easy way for developers to start working on their application using their framework of choice and MongoDB, without the need to setup a development environment, and your app is one command line away (vmc push) from deployment to cloudfoundry.com.
Trisha Gee explores the deeper relationship between the MongoDB database and various languages on the Java Virtual Machine such as Java, Scala, Clojure, JRuby and Python as well as the challenges posted getting MongoDB to play nice with these tools and their syntax. Also examined will be frameworks and integration points popular between MongoDB and the JVM such as Spring Data, Morphia and Lift’s MongoDB-Record component.
This document provides an introduction and overview of MongoTalk and Voyage, two Smalltalk libraries for interacting with MongoDB databases. It demonstrates how to install, configure, and perform basic operations like creating databases and collections, inserting, updating, deleting and querying documents with both libraries. It also shows how to customize mappings and relationships when using Voyage.
This document provides an overview and introduction to MongoDB and Mongoose. It discusses how MongoDB is a document-oriented NoSQL database that stores data as JSON-like documents. It then introduces Mongoose as an object data modeling (ODM) library for MongoDB and Node.js applications that manages connections and schema. Various Mongoose concepts are explained such as schemas, models, CRUD operations, queries, validation, and plugins. The document aims to help developers get started with MongoDB and Mongoose.
This document provides an overview and introduction to MongoDB, an open-source, high-performance NoSQL database. It outlines MongoDB's features like document-oriented storage, replication, sharding, and CRUD operations. It also discusses MongoDB's data model, comparisons to relational databases, and common use cases. The document concludes that MongoDB is well-suited for applications like content management, inventory management, game development, social media storage, and sensor data databases due to its flexible schema, distributed deployment, and low latency.
This document discusses Drupal and MongoDB. It provides an overview of MongoDB as a document-oriented and schema-less database and compares its flexibility, power, speed, and scaling to relational databases. It also describes several Drupal modules that integrate MongoDB as a backend storage mechanism, including for blocks, caching, fields, sessions, queues, and search. Examples are provided of past sessions on using MongoDB with Drupal.
The document discusses the Dust templating engine and how it provides separation of presentation and logic without sacrificing ease of use. It explains that Dust uses keys in templates to reference data in JSON, sections to enumerate blocks, and helpers/partials to add logic. Helpers can be written once and support the DRY principle. Partials allow passing parameters and accessing the parent scope. The document provides examples of using helpers, partials, and JavaScript controls to dynamically render badges based on a user's connection distance and add localization.
This document summarizes an agenda for a schema design workshop. The workshop covers basic schema and patterns, schema design, sharding, and replication in MongoDB. It includes examples of schema design for relational databases and MongoDB, including embedding, linking, inheritance patterns, one-to-many relationships, and many-to-many relationships. The goals are to learn data modeling with MongoDB through labs and understand implications of replication and sharding.
This document discusses Android code templates, which use FreeMarker to generate boilerplate Android code and assets from simple UI parameters. It describes the default ADT templates, how they are located, and how to configure Eclipse to work with templates. It provides an overview of FreeMarker and demonstrates how to create a custom animation template using FreeMarker directives.
The document discusses the growth of humongous data and tools for processing it. It begins with an overview of humongous data and its exponential growth trends. MongoDB and Hadoop are presented as key tools for storing and processing large datasets, with MongoDB suitable for storage and basic operations and Hadoop useful for distributed processing. The document concludes by noting that as data sizes continue growing rapidly, new tools will be needed to analyze "big data," with MongoDB committed to integrating with tools like Hadoop, Storm, and Spark.
Moving to Dojo 1.7 and the path to 2.0James Thomas
With the upcoming 1.7 release, The Dojo Toolkit is beginning to introduce major structural and architectural changes in the toolkit, setting the path for their new major 2.0 release due in 2012.
These fundamental changes to the architecture and technologies underpinning the toolkit will dramatically change how we write Dojo applications in the future, bringing with it huge benefits in performance, cross-library compatibility and support for mobile platforms.
In this presentation, I'll be walking through these changes, explaining the benefits and how it'll impact developers. I'll also be providing migration tips to help you start taking advantage of these benefits in your application today, based upon my experience using Dojo 1.7 on the Watson project.
This talk will be technical in nature, aiming at developers and team leads who are using the toolkit in their products or on client engagements.
This document provides an overview of a presentation on acceptance and integration testing with Behat. It includes slides on setting up the testing environment with Open Box and Ubuntu, an introduction and roadmap for content covered, which includes introductions to BDD and Behat, writing Behat tests, UI testing with Mink, fixture building with Phabric, common contexts in Behat, and a case study of Behat in use. It also includes slides soliciting questions from the audience.
The document discusses a presentation about unit testing TripCase with Jasmine. It covers an overview of unit testing and what parts of an application are best suited for unit testing. It then discusses the specific challenges of unit testing TripCase and analyzes which parts of TripCase are reflexive and algorithmic and therefore good candidates for unit testing. It also covers test-driven development and includes an example of identifying unit test assertions for a hotel search story.
This document provides a summary of JavaScript DOM manipulations and events. It discusses how browsers render pages by creating DOM and render trees. It also covers how JavaScript can manipulate the DOM tree and add interactivity through event handling. Key topics include the event loop, capturing vs bubbling, and the DOM API for finding elements and modifying the document.
MongoDb that holds data in form of documents and have dynamic schema.It provides indexing ,use sharding concept by this it provides scalable environment for sharded cluster.
This document provides an overview of regular expressions (regex). It begins by stating that regex can help find patterns in text and briefly outlines the history of regex from mathematics to its introduction in Unix. It then explains that regex can be used as an alternative to shell wildcards and that many Unix tools incorporate regex. The document proceeds to list programming languages that use regex and provides some basic regex rules including matching single characters, character classes, quantifiers, and assertions. It provides examples to demonstrate matching patterns using these rules.
This document provides an overview of front-end HTML5 web development, including its history from 2004 to becoming a W3C recommendation in 2014. It discusses using new HTML5 features to build complex client-side apps and focuses on teaching attendees how to write front-end code focused on JavaScript to develop modern web applications, demonstrating examples along the way.
The document discusses various statistics related to website load times and how they impact user behavior and business metrics. It states that 47% of consumers expect a page to load within 2 seconds and 73% of mobile users have encountered sites that were too slow. A 1 second delay can result in a 7% loss in conversions. It also discusses studies by Glasses Direct, Walmart and Google on how delays of 50-400 milliseconds can negatively impact conversion rates. The document emphasizes that page load time affects bounce rates, time on site, conversions, user satisfaction and that businesses should care about and measure load times.
This document outlines a course on responsive web design for mobile. The goals are to build a responsive website that works well on any device, understand responsive tools, and learn responsive design techniques. Students should know HTML for content and CSS for styling. The course includes three mobile design challenges to complete the learning.
How to write multi threaded applications using Qt:
In the slides you'll learn about 3 alternatives, all of which allow running tasks simultaneously in Qt applications, and understand the use cases leading to choosing each.
This document discusses improving text editing for Perl developers. It outlines some annoyances with basic text editors like slowing down development. An effective text editor can help developers by providing code snippets, file templates, auto-completion and other features to reduce typing and errors. The document recommends using the Janus text editor plugin collection for Vim, which provides these kinds of features to make editing Perl code faster and easier. It provides instructions for installing Janus and highlights some of its initial capabilities.
This 24-hour course covers the architectural differences system analysts must consider when designing mobile or mobile web applications. It discusses topics like the mobile ecosystem, application layers, device layers, communication networks, and security. The course will help participants understand how to manage sessions, use location services, send push notifications, optimize for networks and address vulnerabilities, through in-depth topics, real-world case studies and a suggested 6-session schedule.
The document discusses key differences between developing for mobile versus desktop. Mobile devices are always connected, have limited battery life, and users expect seamless app switching. Developers must consider interruptions and optimize for battery usage. Each mobile app runs in a sandbox and can communicate through URL schemes or by integrating with OS services. Background execution is more limited on iOS but both platforms allow some background activities like downloading content or playing audio. Developers must respect user expectations and not abuse background capabilities.
This document discusses optimizing mobile networks and applications for speed. It begins with an overview of networking basics and how mobile networks work. It then discusses factors that affect speed like latency, bandwidth, TCP protocols, and cellular network routing. The document provides recommendations for optimizing like leveraging WiFi, anticipating latency, saving bandwidth and battery. It also covers HTTP optimizations, browser APIs and protocols like XHR, SSE and WebSockets. The goal is to understand how networks impact applications and how to design for optimal mobile performance.
The document discusses mobile web architecture and hybrid mobile applications. It begins with an introduction to hybrid apps and PhoneGap. It then covers various HTML5 features that are useful for building hybrid apps like users and sessions, location services, cameras, videos, audio and push notifications. It explains the hybrid architecture of combining web views with native wrappers. It also provides examples of implementing location services, cameras, audio/video and push notifications in a hybrid mobile app.
This document discusses misusing cryptography. It begins with an agenda covering why cryptography is misused and how random number generators and crypto algorithms can be misused. It then discusses examples of what can go wrong, such as a game developer unintentionally allowing hackers to easily determine the secret code protecting scores. The document emphasizes that cryptography is complex and should not be casually misused, as failures can result in compromises like hacked systems and lost jobs. It provides recommendations for proper cryptographic practices.
This document provides an introduction to Selenium, an open source tool for automating web application testing. Selenium allows testing of web applications across different browsers without needing to modify the source code. It works by issuing commands to browser drivers to simulate user interactions such as clicking links, filling forms, and verifying page content. The document outlines how to set up and run automated tests using the Selenium Ruby bindings and RSpec testing framework.
Slides cover how to get started testing your web application. Technologies and concepts explained:
- Unit tests (mocha, jasmine, karma)
- System tests (Selenium)
- Code coverage (istanbul)
- CI servers
This document discusses web accessibility and provides guidance on making websites accessible to people with disabilities. It covers goals of accessibility, challenges for different disabilities, relevant laws, and technical details on how to make elements like images, audio, video, forms, tables, and overall site structure and navigation accessible. The document provides guidelines on topics like alt text, captions, text size and color contrast, keyboard navigation, time limits, languages, and using semantic HTML.
The document provides an overview and introduction to AngularJS. It discusses key Angular concepts like data binding, directives, filters, controllers and scopes. It also covers using Angular for client-side routing and communicating with servers to retrieve data. Example code snippets are provided to demonstrate concepts like controllers, directives and routing. Labs and exercises are included to apply the concepts by building sample Angular applications.
This document discusses JavaScript memory management and common memory leaks. It covers topics like memory lifecycle, garbage collection, detecting memory leaks using dev tools, and ways to minimize memory usage like avoiding global variables and detached DOM nodes. Common sources of memory leaks are discussed such as unbound arrays and objects, multiple copies of functions, and detached DOM nodes not removed from memory. Tools for profiling memory usage like the Chrome Task Manager and Heap Profiler are also presented.
Design Patterns help us solve problems in tried and tested ways.
Turns out they also help us understand our framework better, for framework developers also use patterns.
In these slides you'll see how Design Patterns are implemented by Qt framework, to better both understand patterns and Qt
2. Whoami
Ynon Perek
http://ynonperek.com
ynon@ynonperek.com
Friday, December 7, 12
3. Agenda
MongoDB Overview
Mongo Test Drive
Mongo Data Model
CRUD Operations
Working With Files
Friday, December 7, 12
4. MongoDB Overview
Data Store for
JSON Objects
Friday, December 7, 12
5. MongoDB Overview
Data Store for
JSON Objects
{
“Name” : “Rose Tyler”
}
Friday, December 7, 12
6. JSON Objects
A JSON Object is a collection of key/value pairs
Keys are simple strings
Values can be: Numbers, Strings, Arrays, Other Objects,
and more
Friday, December 7, 12
18. Connecting To The DB
There are two options to work with your new DB
You can use the web console
You can use the command line console
Let’s start with the web.
Friday, December 7, 12
19. Demo: Creating Documents
Create a few
documents on the web
console
Update the data
Delete some of them
Search by fields
Friday, December 7, 12
20. Mongo Data Model
DB Design for relational
database blog app
DB Design for Mongo-
based blog app
Friday, December 7, 12
21. Old-Style Table DB Design
Name Age City of Birth
Jim 22 Ashdod
Mike 21 Eilat
Friday, December 7, 12
27. Lab
Create a DB for musical info
Create a collection called albums
Add info for 3 albums you like, including:
Album Name, Artist, Tracks, Release Date, Genres
Tracks is an array of objects
Genres is an array of strings
Friday, December 7, 12
28. CRUD Operations
Create, Read, Update and Destroy Data
Friday, December 7, 12
29. Mongo CRUD
Create is called insert
Read is called find
Update is called update
Destroy is called remove
Friday, December 7, 12
30. Mongo CRUD
From a developer’s perspective, MongoDB operations are
the same through the driver and through the console
In both cases, operations look like function calls or
method invocations
We’ll use mongo shell for the rest of this chapter
Friday, December 7, 12
31. Inserting Data
Use the command insert or save to insert a new object
db.collection.insert( obj );
db.collection.insert( array );
Friday, December 7, 12
32. Inserting Data
Inserting to a new collection creates the collection
Inserting an object with an _id key, it is used as the
object’s id (and must be unique).
Friday, December 7, 12
33. Reading Data
find and findOne perform read operations
Both take a query
find returns a cursor
findOne returns an object Optional: Fields to
fetch
db.collection.find( <query>, <projection> )
Friday, December 7, 12
34. Query Document
An empty (or missing) query document returns
everything
db.collection.find({})
db.collection.find()
Friday, December 7, 12
35. Query Document
Each key/value pair in the query document imposes a
condition on the results (objects that match).
db.movies.find({ “genre” : “indie” });
db.books.find({“pages” : { “$gt” : 100 }});
Friday, December 7, 12
36. Query Document
Query Object
Each key/value pair in the query document imposes a
condition on the results (objects that match).
db.movies.find({ “genre” : “indie” });
db.books.find({“pages” : { “$gt” : 100 }});
Friday, December 7, 12
37. Query Document
A compound query means a logical AND on the
conditions.
db.inventory.find(
{
“type” : “snacks”,
“available” : { “$lt” : 10 }
});
Friday, December 7, 12
38. Quiz: What Is Returned
from alterego publisher
Bruce
{ Earth DC
Wayne
“publisher” :
“DC”
} Peter
Earth Marvel
Parker
Krypton Clark Kent DC
Friday, December 7, 12
39. Quiz: What Is Returned
from alterego publisher
{ Bruce
“publisher” : Earth DC
Wayne
“DC”,
“from” :
“Earth” Peter
Earth Marvel
} Parker
Krypton Clark Kent DC
Friday, December 7, 12
40. More Queries
You can use “$or” to have an OR expression
{
“$or” : [
{ “type” : “food” },
{ “type” : “drinks” }
]
}
Friday, December 7, 12
41. Sub Documents
If your document has sub-documents, it’s possible to
query by a full sub document or look for a partial match
Full sub-document query means subdocument is exactly
as specified in the query
Example:
{ ISBN : { “ISBN-10” : “1906465592”,
“ISBN-13” : “978-1906465599” }}
Friday, December 7, 12
42. Sub Documents
A partial query matches all objects that have at least the
required field (but may contain more)
Example:
{
“language.primary” : “english”
}
Value of language is an object, and it has a field called
primary
Friday, December 7, 12
43. Arrays
You can use an exact array match by providing the full
array in the query
Example:
{
tags : [ “funny”, “cute”, “cats” ]
}
Friday, December 7, 12
44. Arrays
You can query for an array that has at least one element
matching the query
Example:
{ “tags” : “funny” }
Friday, December 7, 12
45. Arrays
If you have a subdocument as the element of an array,
it’s possible to query by its fields using the dot notation.
Examples:
{ “tracks.4.name” : “Rose Mary Stretch” }
{ “tracks.name” : “Rose Mary Stretch” }
Friday, December 7, 12
46. Query Operators
Complex queries are performed with special operators.
These are reserved words starting with a $
Some of them: $gt, $gte, $lt, $lte, $ne, $in, $nin, $all,
$or, $not
Friday, December 7, 12
47. Comparator Queries
Value for key a is greater than 10
{ “a” : { “$gt” : 10 }}
Value for key b is not 7
{ “b” : { “$ne” : 7 }}
Value for key name is greater (ascii-wise) than ‘bird’
{ “name” : { “$gt” : “bird” }}
Friday, December 7, 12
48. Queries: $in, $nin
Use $in to specify a choice from multiple options
Value for grade is 85, 90 or 100
{ “grade” : { “$in” : [ 85, 90, 100 ] } }
Value for fruit is neither apple nor banana
{ “fruit” : { “$nin” : [“apple”, “banana” ] } }
Friday, December 7, 12
49. Quiz: What Is Selected
{ “reads” : { “$gt” : 10 },
“author” : { “$nin” : [“admin”, “manager”, “boss” ] } }
author reads title
How To Use
admin 99
Mongo
How To Make
Joe 120
Money
Windows
Jim 8
Manual
Friday, December 7, 12
50. Queries: $all
Select objects with array containing all elements
Example:
{ “tags” : { “$all” : [ “funny”, “cats” ] } }
Friday, December 7, 12
51. More Query Operators
“$size” - array has a specific number of elements
“$exists” - field present or missing
Example:
{ “friends” : { “$size” : 7 } }
{ “producer” : { “$exists” : false } }
Friday, December 7, 12
52. Aggregation
count() - returns how many objects found
distinct() - returns all distinct values for a key
Example:
db.posts.distinct( “tags” )
Friday, December 7, 12
55. Lab
Using the previously defined musical DB. Query for:
Albums released after/before 2008
Albums with 7 tracks
Albums by a specific genre
Albums by a specific track name
Display ALL different genres in the DB
Friday, December 7, 12
56. Update
Update operations modify existing data in the DB
Mongo supports two update commands:
update() and save()
Update is the more general (and complex)
Friday, December 7, 12
57. Update
The general form for update is:
db.collection.update(
<query>, <update>, <options> )
Which Entries What to do with
to update them
Friday, December 7, 12
58. Update
The second argument to update() is an operator object
It tells update what to do with the data
Some keys you can use: “$set”, “$inc” “$push”,
“$pushAll”, “$addToSet”, “$pop”, “$pull”, “$pullAll”
Friday, December 7, 12
59. Update: set
$set modifies a value or add a new value
Example:
db.posts.update(
{ title: “Why Is Your Cat Unhappy” },
{ $set : { “archived” : true } }
);
Friday, December 7, 12
60. Quiz: $set
What happens here ?
db.cats.update(
{ color: “white” },
{ “$set” : { “owners” : [“John”, “Jim”] } }
);
Friday, December 7, 12
61. Quiz: $set
Update owners array of the first cat with white color
If you want to update all objects, use multi
db.cats.update(
{ color: “white” },
{ “$set” : { “owners” : [“John”, “Jim”] } }
{ multi : true }
);
Friday, December 7, 12
62. Update: inc
$inc increases a numeric value
Example:
{ “$inc” : { “age” : 11 } }
Friday, December 7, 12
63. Quiz: $inc
What happens here ?
db.songs.update(
{ “title” : “Killing Lies” },
{ “$inc” : { “plays” : 1 } }
);
Friday, December 7, 12
64. Update: push and pushAll
push() and pushAll() add items to an existing array
If they array did not exists, it is created
Example:
db.creatures.update(
{ name: “The Doctor” },
{ “$push” : { companions : “Rose Tyler” } }
)
Friday, December 7, 12
65. Update: addToSet
The $addToSet adds a new item only if it wasn’t already
in the array
Example:
{ “$addToSet” : { “tags” : “funny” } }
Friday, December 7, 12
66. Update: pop
pop removes items of an array
Use a value of 1 to remove the last element
Use a value of -1 to remove the first element
Example:
{ “$pop” : { “companions” : 1 } }
Friday, December 7, 12
67. Update: pull
Remove a specific item from an array.
Can use $pullAll to remove all matching elements
Example:
{ “$pull” : { “companions” : “Rose Tyler” } }
Friday, December 7, 12
68. Updating with save()
The second update operation is save()
takes a document:
If the document has an id - update it
If not, insert it to the DB
Friday, December 7, 12
69. Deleting Data
remove() deletes objects from a collection
Takes a query and possibly a <justOne> arguments
Examples:
db.posts.remove({ “author” : “Father Angelo” })
db.music.remove({ “genres” : “pop” })
db.posts.remove({ “tags” : “funny” }, 1 );
Friday, December 7, 12
71. Lab
From the previous music database:
Add a new album with 4 tracks
Add a new track to that new album
Set property “plays” on all albums to 6
Increase it by 4 only for “indie” albums
Delete all “indie” music
Friday, December 7, 12
72. Thank You
Photos from: http://123rf.com
Slides available at: http://ynonperek.com
Friday, December 7, 12