This document provides an overview of MongoDB including:
- MongoDB is a document-oriented NoSQL database where data is stored in JSON-like documents rather than tables. It supports indexing but does not support traditional joins or transactions.
- Documents can contain nested objects and arrays. Data is stored and queried using JavaScript-like syntax.
- Common operations include insert, find, update, remove, and aggregation operations using the mongo shell or driver APIs. Indexes, cursors, and aggregation pipelines can be used to optimize queries.
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
This intermediate-level talk will teach you techniques using the popular NoSQL database MongoDB and the Python library Ming to write maintainable, high-performance, and scalable applications. We will cover everything you need to become an effective Ming/MongoDB developer from basic PyMongo queries to high-level object-document mapping setups in Ming.
This talk is focused on tuning analysing and optimizing MongoDB query and index with the use of Database Profiler and "explain()" function.
Also, performance of database can also be impacted by configuring the underline ( Linux ) OS with some recommended settings which do not come by default.
Aggregation pipeline has been able to power your analysis of data since version 2.2. In 4.2 we added more power and now you can use it for more powerful queries, updates, and outputting your data to existing collections. Come hear how you can do everything with the pipeline, including single-view, ETL, data roll-ups and materialized views.
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
Query performance can either be a constant headache or the unsung hero of an application. MongoDB provides extremely powerful querying capabilities when used properly. As a member of the solutions architecture team I will share more common mistakes observed and some tips and tricks to avoiding them.
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
This intermediate-level talk will teach you techniques using the popular NoSQL database MongoDB and the Python library Ming to write maintainable, high-performance, and scalable applications. We will cover everything you need to become an effective Ming/MongoDB developer from basic PyMongo queries to high-level object-document mapping setups in Ming.
This talk is focused on tuning analysing and optimizing MongoDB query and index with the use of Database Profiler and "explain()" function.
Also, performance of database can also be impacted by configuring the underline ( Linux ) OS with some recommended settings which do not come by default.
Aggregation pipeline has been able to power your analysis of data since version 2.2. In 4.2 we added more power and now you can use it for more powerful queries, updates, and outputting your data to existing collections. Come hear how you can do everything with the pipeline, including single-view, ETL, data roll-ups and materialized views.
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
Query performance can either be a constant headache or the unsung hero of an application. MongoDB provides extremely powerful querying capabilities when used properly. As a member of the solutions architecture team I will share more common mistakes observed and some tips and tricks to avoiding them.
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
Query performance can either be a constant headache or the unsung hero of an application. MongoDB provides extremely powerful querying capabilities when used properly. As a senior member of the support team I will share more common mistakes observed and some tips and tricks to avoiding them.
In a real life almost any project deals with the
tree structures. Different kinds of taxonomies,
site structures etc require modeling of
hierarchy relations.
Typical approaches used
● Model Tree Structures with Child References
● Model Tree Structures with Parent References
● Model Tree Structures with an Array of Ancestors
● Model Tree Structures with Materialized Paths
● Model Tree Structures with Nested Sets
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Grant Goodale
WordSquared is a massively multiplayer online scrabble crossword that uses MongoDB to store location data. Players place tiles in realtime, and compete to build the longest chain of words and earn points. WordSquared leverages MongoDB's built-in geospatial indexing, storing an x and y coordinate with each tile and using bounding box queries to
display a view of the board.
This presentation covers the architecture of the game, with a specific focus on the use of MongoDB, storing and querying location data, and learning how to structure and even shard geo data through the unlikely use
case of an infinitely large board game.
Webinar: Strongly Typed Languages and Flexible SchemasMongoDB
Strong statically typed languages are safer because they capture programmer intent. Dynamic schemas are flexible and allow for rapid development. Having both at the same time, on the same system is a great way to build an easy to iterate, modularized and flexible application, but these properties can also generate some friction. There are a set of rules and best practices around schema versions and data type validations that are crucial to make this symbiotic system work properly.
Over the course of this webinar we will show you techniques and mechanisms to use when modeling your system with MongoDB. We will review schema design best practices and real world examples that deal with these complex topics.
We will focus on making sure you understand the benefits and performance gains of using both strongly statically typed languages along with dynamic and flexible schema database like MongoDB.
Strongly Typed Languages and Flexible SchemasNorberto Leite
We like to use strongly type languages and used them along side with flexible schema databases. What challenges and strategies do we have to deal with data coherence and format validations using different strategies and tools like ODMs versioning, migrations et al. We also review the tradeoffs of such strategies.
We all know that MongoDB is one of the most flexible and feature-rich databases available. In this session we'll discuss how you can leverage this feature set and maintain high performance with your project's massive data sets and high loads. We'll cover how indexes can be designed to optimize the performance of MongoDB. We'll also discuss tips for diagnosing and fixing performance issues should they arise.
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)Paul Richards
Presentation given by Chris Hopkinson at May Sheffield R Users Group meeting - how to (potentially) win $10m using association rules with data from the DOTA2 API
Building a Scalable Inbox System with MongoDB and Javaantoinegirbal
Many user-facing applications present some kind of news feed/inbox system. You can think of Facebook, Twitter, or Gmail as different types of inboxes where the user can see data of interest, sorted by time, popularity, or other parameter. A scalable inbox is a difficult problem to solve: for millions of users, varied data from many sources must be sorted and presented within milliseconds. Different strategies can be used: scatter-gather, fan-out writes, and so on. This session presents an actual application developed by 10gen in Java, using MongoDB. This application is open source and is intended to show the reference implementation of several strategies to tackle this common challenge. The presentation also introduces many MongoDB concepts.
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
Query performance can either be a constant headache or the unsung hero of an application. MongoDB provides extremely powerful querying capabilities when used properly. As a senior member of the support team I will share more common mistakes observed and some tips and tricks to avoiding them.
In a real life almost any project deals with the
tree structures. Different kinds of taxonomies,
site structures etc require modeling of
hierarchy relations.
Typical approaches used
● Model Tree Structures with Child References
● Model Tree Structures with Parent References
● Model Tree Structures with an Array of Ancestors
● Model Tree Structures with Materialized Paths
● Model Tree Structures with Nested Sets
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Grant Goodale
WordSquared is a massively multiplayer online scrabble crossword that uses MongoDB to store location data. Players place tiles in realtime, and compete to build the longest chain of words and earn points. WordSquared leverages MongoDB's built-in geospatial indexing, storing an x and y coordinate with each tile and using bounding box queries to
display a view of the board.
This presentation covers the architecture of the game, with a specific focus on the use of MongoDB, storing and querying location data, and learning how to structure and even shard geo data through the unlikely use
case of an infinitely large board game.
Webinar: Strongly Typed Languages and Flexible SchemasMongoDB
Strong statically typed languages are safer because they capture programmer intent. Dynamic schemas are flexible and allow for rapid development. Having both at the same time, on the same system is a great way to build an easy to iterate, modularized and flexible application, but these properties can also generate some friction. There are a set of rules and best practices around schema versions and data type validations that are crucial to make this symbiotic system work properly.
Over the course of this webinar we will show you techniques and mechanisms to use when modeling your system with MongoDB. We will review schema design best practices and real world examples that deal with these complex topics.
We will focus on making sure you understand the benefits and performance gains of using both strongly statically typed languages along with dynamic and flexible schema database like MongoDB.
Strongly Typed Languages and Flexible SchemasNorberto Leite
We like to use strongly type languages and used them along side with flexible schema databases. What challenges and strategies do we have to deal with data coherence and format validations using different strategies and tools like ODMs versioning, migrations et al. We also review the tradeoffs of such strategies.
We all know that MongoDB is one of the most flexible and feature-rich databases available. In this session we'll discuss how you can leverage this feature set and maintain high performance with your project's massive data sets and high loads. We'll cover how indexes can be designed to optimize the performance of MongoDB. We'll also discuss tips for diagnosing and fixing performance issues should they arise.
How to win $10m - analysing DOTA2 data in R (Sheffield R Users Group - May)Paul Richards
Presentation given by Chris Hopkinson at May Sheffield R Users Group meeting - how to (potentially) win $10m using association rules with data from the DOTA2 API
Building a Scalable Inbox System with MongoDB and Javaantoinegirbal
Many user-facing applications present some kind of news feed/inbox system. You can think of Facebook, Twitter, or Gmail as different types of inboxes where the user can see data of interest, sorted by time, popularity, or other parameter. A scalable inbox is a difficult problem to solve: for millions of users, varied data from many sources must be sorted and presented within milliseconds. Different strategies can be used: scatter-gather, fan-out writes, and so on. This session presents an actual application developed by 10gen in Java, using MongoDB. This application is open source and is intended to show the reference implementation of several strategies to tackle this common challenge. The presentation also introduces many MongoDB concepts.
MongoDB is a popular NoSQL database. This presentation was delivered during a workshop.
First it talks about NoSQL databases, shift in their design paradigm, focuses a little more on document based NoSQL databases and tries drawing some parallel from SQL databases.
Second part, is for hands-on session of MongoDB using mongo shell. But the slides help very less.
At last it touches advance topics like data replication for disaster recovery and handling big data using map-reduce as well as Sharding.
Webinar: General Technical Overview of MongoDB for Dev TeamsMongoDB
In this talk we will focus on several of the reasons why developers have come to love the richness, flexibility, and ease of use that MongoDB provides. First we will give a brief introduction of MongoDB, comparing and contrasting it to the traditional relational database. Next, we’ll give an overview of the APIs and tools that are part of the MongoDB ecosystem. Then we’ll look at how MongoDB CRUD (Create, Read, Update, Delete) operations work, and also explore query, update, and projection operators. Finally, we will discuss MongoDB indexes and look at some examples of how indexes are used.
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB
Encryption is not a new concept to MongoDB. Encryption may occur in-transit (with TLS) and at-rest (with the encrypted storage engine). But MongoDB 4.2 introduces support for Client Side Encryption, ensuring the most sensitive data is encrypted before ever leaving the client application. Even full access to your MongoDB servers is not enough to decrypt this data. And better yet, client side encryption can be enabled at the "flick of a switch". This session covers using client side encryption in your applications. This includes the necessary setup, how to encrypt data without sacrificing queryability, and what trade-offs to expect.
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB
Encryption is not a new concept to MongoDB. Encryption may occur in-transit (with TLS) and at-rest (with the encrypted storage engine). But MongoDB 4.2 introduces support for Client Side Encryption, ensuring the most sensitive data is encrypted before ever leaving the client application. Even full access to your MongoDB servers is not enough to decrypt this data. And better yet, Client Side Encryption can be enabled at the "flick of a switch".
This session covers using Client Side Encryption in your applications. This includes the necessary setup, how to encrypt data without sacrificing queryability, and what trade-offs to expect.
Tips and Tricks for Avoiding Common Query PitfallsMongoDB
Query performance can either be a constant headache or the unsung hero of an application. MongoDB provides extremely powerful querying capabilities when used properly. As a member of the support team I will share common mistakes observed as well as tips and tricks to avoiding them.
Presented by Norberto Leite, Developer Advocate, 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. You will learn:
- How to work with documents
- Evolve your schema
- Common schema design patterns
• Distributed datasets loaded into named columns (similar to relational DBs or
Python DataFrames).
• Can be constructed from existing RDDs or external data sources.
• Can scale from small datasets to TBs/PBs on multi-node Spark clusters.
• APIs available in Python, Java, Scala and R.
• Bytecode generation and optimization using Catalyst Optimizer.
• Simpler DSL to perform complex and data heavy operations.
• Faster runtime performance than vanilla RDDs.
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...John Andrews
SlideShare Description for "Chatty Kathy - UNC Bootcamp Final Project Presentation"
Title: Chatty Kathy: Enhancing Physical Activity Among Older Adults
Description:
Discover how Chatty Kathy, an innovative project developed at the UNC Bootcamp, aims to tackle the challenge of low physical activity among older adults. Our AI-driven solution uses peer interaction to boost and sustain exercise levels, significantly improving health outcomes. This presentation covers our problem statement, the rationale behind Chatty Kathy, synthetic data and persona creation, model performance metrics, a visual demonstration of the project, and potential future developments. Join us for an insightful Q&A session to explore the potential of this groundbreaking project.
Project Team: Jay Requarth, Jana Avery, John Andrews, Dr. Dick Davis II, Nee Buntoum, Nam Yeongjin & Mat Nicholas
As Europe's leading economic powerhouse and the fourth-largest hashtag#economy globally, Germany stands at the forefront of innovation and industrial might. Renowned for its precision engineering and high-tech sectors, Germany's economic structure is heavily supported by a robust service industry, accounting for approximately 68% of its GDP. This economic clout and strategic geopolitical stance position Germany as a focal point in the global cyber threat landscape.
In the face of escalating global tensions, particularly those emanating from geopolitical disputes with nations like hashtag#Russia and hashtag#China, hashtag#Germany has witnessed a significant uptick in targeted cyber operations. Our analysis indicates a marked increase in hashtag#cyberattack sophistication aimed at critical infrastructure and key industrial sectors. These attacks range from ransomware campaigns to hashtag#AdvancedPersistentThreats (hashtag#APTs), threatening national security and business integrity.
🔑 Key findings include:
🔍 Increased frequency and complexity of cyber threats.
🔍 Escalation of state-sponsored and criminally motivated cyber operations.
🔍 Active dark web exchanges of malicious tools and tactics.
Our comprehensive report delves into these challenges, using a blend of open-source and proprietary data collection techniques. By monitoring activity on critical networks and analyzing attack patterns, our team provides a detailed overview of the threats facing German entities.
This report aims to equip stakeholders across public and private sectors with the knowledge to enhance their defensive strategies, reduce exposure to cyber risks, and reinforce Germany's resilience against cyber threats.
5. mongod (launch server)
mongo (launch client)
mongorestore (load a db into mongo)
use database (within client, use spceific db)
db.collection.findOne();
6. Download/extract mongodb files
Either update Path to include bin folder or navigate to bin folder …
Create folder for data …
> md data -> md datadb (remember where you created this folder)
> mongod --dbpath c:datadb (default path onWindows)
▪ Now the mongodb server will be running (unless there is a problem)
From another command shell launch client: > mongo
▪ Now the mongodb shell will be running
▪ Try the following commands:
▪ show databases
▪ db
▪ show collections
7. Create - Insert
Read - Find
Update - Update
Delete - Remove
Everything is a method/API, not as SQL syntax
Valid: db.names.find()
Invalid: slect * from names
8. javascript interpreter
> for (i=0;i<3;i++) print("hello");
> help
> help keys
auto complete with tab
> z = {"a":1}
> z.a
> z["a"]
> x={a:1}; y="a"; x[y]++; print(x.a); // output is 2
10. > doc = {name: "Brady", age: 38, team: "Patriots"}
If players collection doesn’t exist, it will create one
db.players.insert(doc)
db.players.find()
"_id" is a unique id created by the database; immutable
> db.players.findOne() // random document
> db.players.remove({}) // remove all objects in collection
> db.players.delete() // remove the entire collection
11.
12. > db.players.findOne()
> db.players.findOne("name": "Brady")
> db.players.findOne({"name":"Brady", {"_id": false})
> db.players.findOne({"name":"Brady", {"_id": false, "name": true})
> db.players.find().pretty() // well-formatted
> db.players.count("name" : "Brady") // Count of records
> db.players.find({"name":"Brady", "age": 38}).pretty()
> db.players.find({"age": {$gt:30} }).pretty() // greater than 30
> db.players.find({"age": {$lt:40} }).pretty() // less than 40
> db.players.find({"age": {$gte:30, $lte:40}).pretty() // between 30
and 40
14. > db.players.find({"city": {$exists: true}})
> db.players.find({"city": {$exists: false}})
> db.players.find({"name": {$type: 2}}) // BSONTypes Numbers
docs.mongodb.org/manual/reference/bson-types/
// find all players with a "w" in the name key
> db.players.find({name: {$regex: "w"}}, {"_id":false, "name":true})
// find all players with names ending in "n"
> db.players.find({name: {$regex: "n$"}}, {"_id":false, "name":true})
// find all players with names that start with "b"
> db.players.find({name: {$regex: "^b"}}, {"_id":false, "name":true})
15. // find players that have age of 38 OR have a city
> db.players.find({$or: [{"age":38}, {"city": {$exists:true}}]})
// find players that have age 38 AND name equals "Brady"
> db.players.find({$and [{age:38}, {name:"Brady"}]})
// same as … a bit more efficient
> db.players.find({age:38, name:"Brady"})
//What about this?Think about javascript behavior!!
> db.players.find({age:38, age:40})
21. Combines Update/Insert
Excellent use case when you don't know if a document already
exists
> db.players.update({name:"Zahid"}, {$set: {age:30, team:
"Patriots"}}, {upsert: true} )
> db.players.find({name:"Zahid"}).pretty()
{
"_id" : ObjectId("55ca7b04f971f0ee874cf2af"),
"name" : "Zahid",
"age" : 30,
"team" : "Patriots"
}
22. {} empty document matches every document in collection
db.players.update({}, {$set : {newcol:10}})
Above statement will only update one document (the first
one)
To add newcol to all documents, use the multi option
db.players.update({}, {$set : {newcol:10}}, {multi: true})
Concurrency issues
Transactions are not isolated
If 10000 updates, possible that 2 different reads could get different
results
23. db.players.remove( {name: "brady"})
db.players.remove({}) // no need for multi option
db.players.drop() // drop the entire collection; more efficient
24. > db.players.ensureIndex({name:1}, {unique:true}) // ensure
unique index on name
> db.players.ensureIndex({name:1, age:1}) // compound index
on name and age
> db.players.getIndexes() // retrieves a list of all indexes on
players collections
> db.players.getIndexSize() // number of bytes allocated to
indexes
> db.players.reIndex()
27. > db.grades.findOne()
{
"_id" : ObjectId("50906d7fa3c412bb040eb577"),
"student_id" : 0,
"type" : "exam",
"score" : 54.6535436362647
}
// sql: selectTop 1 student_id _id, avg(score) average from grades group by student_id order by avg(score) desc
> db.grades.aggregate(
{'$group':{'_id':'$student_id', 'average':{$avg:'$score'}}},
{'$sort':{'average':-1}},
{'$limit':1})
// select student_id _id, min(score) min from grades where score >= 65 group by student_id order by min(score)
> db.grades.aggregate([
{ $match : { score : {$gte : 65 } } },
{ '$group': {'_id':'$student_id', 'min': { $min:'$score'} } },
{ '$sort': { 'min': 1 } } ] );
28. $bit - performs bitwise AND, OR, and XOR updates on integer values
$mod - performs a modulo operation on the value of a field
$not - returns documents that do not match query expression
$nor - returns documents that fail to match both clauses (as in "neither/nor")
Geospatial methods like $geoWithin, $geoIntersects, $near, $nearSphere
$hint - forces the query optimizer to use specific index
db.collection.find().explain() // retrieve query execution plan
$maxTimeMS - specifies maximum time for execution of query
$natural - sort documents by natural order (ordering of documents internally
within database)
$project - reshapes each document in the stream (adding new fields or removing
fields)
$cmp, $eq, $gt, $gte, $lt, $lte, $ne (equality operators)