This talk will introduce the features of MongoDB by walking through how one can building a simple location-based checkin application using MongoDB. The talk will cover the basics of MongoDB's document model, query language, map-reduce framework and deployment architecture.
6. What will you learn
here?
• Data Modeling
• Queries
• Geospatial indexing
7. What will you learn
here?
• Data Modeling
• Queries
• Geospatial indexing
• Updates
8. What will you learn
here?
• Data Modeling
• Queries
• Geospatial indexing
• Updates
• Map/Reduce
9. What will you learn
here?
• Data Modeling
• Queries
• Geospatial indexing
• Updates
• Map/Reduce
• Deployment and Scaling Concerns
10. What will you learn
here?
• Data Modeling
• Queries
• Geospatial indexing
• Updates
• Map/Reduce
• Deployment and Scaling Concerns
• Why MongoDB?
11. Our Application
• Users can create different locations
• Users can “check in” to these locations
• Users can see who else is checked in
• Let’s call it ThreeTriangles (3tri)
32. Use Cases
• Replace RDBMS for high-traffic web
applications
• CMS-style applications
• Social and mobile applications
• Real-time analytics, high-speed logging
• Maybe not double-entry bookkeeping
33. What do you give up?
• No multi-document atomic operations (i.e.
transactions)
• No server-side JOINs
• No referential integrity constraints
between documents
• Data model is typically tied to query
patterns (less flexible than relational DBs)
34. Questions?
Please rate this talk at http://svy.mk/L3jM7f
Interested in training? http://Arborian.com/training
MongoDB Info & Downloads: http://mongodb.org
Rick Copeland
@rick446
http://arborian.com
Editor's Notes
\n
SF - early adopters of MongoDB (0.8), so we went through some of the growing pains\nSQLAlchemy - I don’t hate SQL!\nKnow Python best, but also C, C++, etc.\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Tend to not have auto-increment keys\nStandard JSON values + a few new primitives\nEmbedded docs & arrays OK (and encouraged!)\n
\n
Lots of places, hard to find the one you need\n
Better, now at least we’re just looking for hotels, still too many\n
Results sorted by distance\n
Embedded tips for data locality\n
Regex has same benefits and drawbacks as LIKE in sql -- prefix queries are your friend!\n
Lots of in-place operators so you can update your document atomically (makes transactionlessness less important)\n
So we’ve mostly covered the “Places” side, now let’s look at “Checkins”\n
\n
Checking in inserts checkin and then $pushes user object\n
You can also “reach inside” your objects for updating\n
\n
\n
Flexible output options for dumping results in a collection\n
\n
\n
Data automatically balanced between replica sets\nConfig server stores ‘chunk’ locations\nTransparent to applications\n
\n
No transactions, but doc model is rich enough to do without in many apps\nNo server-side JOIN, but can be emulated in client (use $in)\nNo referential integrity, but 1:N joins become embedded documents\nData model *can* be relational, but you give up performance (and introduce integrity issues, etc) - many will just denormalize data to get both flexibility and performance at the expense of application complexity.\n