SlideShare a Scribd company logo
NoSQL with ColdFusion
       Using MongoDB


           Indy Nagpal
      CFObjective, Melbourne, 2011
About me
About me
✴   Straker Translations, New Zealand
✴   Been working with CF for a while now
✴   Cloud-based applications using Railo
✴   Love CFWheels
✴   nagpals.com/blog, @indynagpal
NoSQL?
NoSQL?

✴   Different things to different people
✴   Non-Relational rather than NoSQL
✴   System for storage/retrieval of data
✴   Persistence layer is not a responsibility of a
    single system
Why NoSQL?
Why NoSQL?


✴   100s of millions of items in a big table
Why NoSQL?


✴   100s of millions of items in a big table
✴   Dynamic data structure
Using NoSQL MongoDB with ColdFusion
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
SQL                           NoSQL

     Static Data Structure        Dynamic Data Structure

       Dynamic Query              Static Query (generally)

         Consistency                Eventual consistency

         Transactions               Limited Transactions

     Difficult to distribute       Distributed, fault-tolerant

Limited performance under load Optimized for heavy read-write
NoSQL DBs
NoSQL DBs
✴   Used with CF
    ✴   Apache CouchDB
    ✴   MongoDB
    ✴   Amazon SimpleDB


✴   CF/Java Wrappers available
What is MongoDB
What is MongoDB
✴   A Document-oriented database
✴   “Humongous”
✴   Scalable, high-performance, open-source
✴   An alternative to relational databases
✴   One of the NoSQL technologies
Key Difference
Key Difference
✴   Most No-SQL databases
    ✴   dynamic data
    ✴   static queries
✴   MongoDB
    ✴   dynamic data
    ✴   dynamic and static queries
Basic Concepts
Basic Concepts
✴   Database
Basic Concepts
✴   Database
✴   Collections (broadly like table)
Basic Concepts
✴   Database
✴   Collections (broadly like table)
✴   Documents (like row)
Basic Concepts
✴   Database
✴   Collections (broadly like table)
✴   Documents (like row)
✴   Fields (like columns)
Basic Concepts
✴   Database
✴   Collections (broadly like table)
✴   Documents (like row)
✴   Fields (like columns)
✴   Collections are indexed
Basic Concepts
✴   Database
✴   Collections (broadly like table)
✴   Documents (like row)
✴   Fields (like columns)
✴   Collections are indexed
✴   Cursors (retrieve data as required)
Concepts
Concepts
✴   New terminology

✴   Similar ideas, but not identical

✴   RDBMS - columns defined for tables

✴   NoSQL - fields defined for documents

✴   Collections are more like containers
Drivers
Drivers
✴   Officially supported drivers
✴   Language-specific drivers (Java, Ruby, etc.)
✴   Framework-specific (MongoMapper)
✴   Wrappers built on top of drivers
    ✴   cfmongodb built on Java drivers
✴   Unlike Apache CouchDB that uses REST
BSON
BSON
✴   Binary JSON format
✴   Supports embedding of documents and
    arrays within other documents and arrays
✴   Lightweight
✴   Traversable
✴   Efficient
✴   bsonspec.org
CF and Mongo
CF and Mongo
✴   cfmongodb (on Github) -- excellent
✴   Wrapper around Java drivers
✴   Most functionality encapsulated
    ✴   Inserts, updates, delete, find
    ✴   Map-reduce, Geospatial
CF and BSON
•   Structs/arrays persisted as they are!


                      people = mongo.getDBCollection(“people”)

                      person = {
                        “fname” : “John”,
                        “lname” : “Doe”
                      }

                      people.save(person)
Init
Init
mongoConfig = createObject(
              'component',
              'cfmongodb.core.MongoConfig').init(dbName="test")
Init
mongoConfig = createObject(
              'component',
              'cfmongodb.core.MongoConfig').init(dbName="test")


mongo = createObject('component',
              'cfmongodb.core.Mongo').init(mongoConfig)
Init
mongoConfig = createObject(
              'component',
              'cfmongodb.core.MongoConfig').init(dbName="test")


mongo = createObject('component',
              'cfmongodb.core.Mongo').init(mongoConfig)

people = mongo.getDBCollection('people')
Add Data
Add Data
// create some data
newPeople = []
Add Data
// create some data
newPeople = []


arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘john@doe.com’})
Add Data
// create some data
newPeople = []


arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘john@doe.com’})


arrayAppend(newPeople, {‘fname’: ‘Jane’, ‘lname’ : ‘Doe’})
Add Data
// create some data
newPeople = []


arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘john@doe.com’})


arrayAppend(newPeople, {‘fname’: ‘Jane’, ‘lname’ : ‘Doe’})


// save everything at once
people.saveAll(newPeople)
Find / Update
Find / Update

person = people.query().$eq("fname", "Jane").find()
Find / Update

person = people.query().$eq("fname", "Jane").find()


// update a record
person[“email”] = “jane@doe.com”
person.update(person)
Tools
Tools
✴   Terminal console
✴   MongoHub (Mac)
✴   MongoExplorer, MongoVision (Windows)


✴   SSH Tunnel to connect
✴   mongohq.com (hosted MongoDB/admin)
MongoDB and Railo
MongoDB and Railo
✴   Railo Extension
✴   Cache CF variables/data
✴   Store key-value pairs
    ✴   cacheGet()
    ✴   cachePut()
Queries and Map-
    reduce
Queries and Map-
         reduce
✴   Queries - rapid development
✴   Map-reduce - advanced querying


✴   Query and Map-reduce together give
    MongoDB an edge over other NoSQL
    alternatives
Data Modeling
Data Modeling

✴   No Joins! Scary?
✴   Embedding documents supported via ID
✴   Big mind shift
✴   ‘Fear’ of duplicate data drives design
    decisions in relational db world
CF ORM
CF ORM
✴   No support in CF ORM frameworks
✴   Other language frameworks more
    advanced
    ✴   Ruby on Rails - mongomapper


✴   Need ORM integration for wider adoption
Asynchronous
Asynchronous

✴   Asynchronous inserts/updates
✴   Journaled


✴   Capped Collections (FIFO)
Time taken to add 20,000 records with 5 words in each record


                                                               30

                                                               25




                                                                     Time in Seconds
                                                               20

                                                               15

                                                               10

                                                               5

                                                               0




mysql (cfquery)       filesystem (cflog)         mongodb (cfmongodb)
Compelling features
Compelling features
✴   On-demand database and collection
    creation
✴   Asynchronous writes
✴   Replication - simple and easy
✴   Large-scale data processing
✴   Sharding - horizontal scaling
✴   Geospatial indexes
When to use?
When to use?

✴   Relational DBs suffice for most projects
    ✴   Abstraction via ORM is very useful
✴   MongoDB -- alternative/add-on
✴   Removes reliance on only one data storage
    mechanism
Learning Curve
Learning Curve
✴   Syntax
✴   Concepts like sharding, replication
✴   Well-documented / blogged
✴   Active mailing list
✴   Being used in production
So...
So...

✴   Another tool to have in one’s kit
✴   Extremely useful and easy to use
✴   Worth spending some time on
Thank you!

        @indynagpal
    indy@nagpals.com
  http://nagpals.com/blog
Ad

More Related Content

What's hot (20)

MongoDB
MongoDBMongoDB
MongoDB
SPBRUBY
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
JWORKS powered by Ordina
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
Norberto Leite
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
PostgreSQL Experts, Inc.
 
Mongo DB
Mongo DBMongo DB
Mongo DB
Karan Kukreja
 
Migrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at FacebookMigrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at Facebook
MariaDB plc
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB Performance
Tim Callaghan
 
Lokijs
LokijsLokijs
Lokijs
Joe Minichino
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22nd
Ido Shilon
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger Overview
WiredTiger
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
NexThoughts Technologies
 
MongoDB London PHP
MongoDB London PHPMongoDB London PHP
MongoDB London PHP
Mike Dirolf
 
Mongo db3.0 wired_tiger_storage_engine
Mongo db3.0 wired_tiger_storage_engineMongo db3.0 wired_tiger_storage_engine
Mongo db3.0 wired_tiger_storage_engine
Kenny Gorman
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
Pantheon
 
Intro Couchdb
Intro CouchdbIntro Couchdb
Intro Couchdb
selvamanisampath
 
Redis : Database, cache, pub/sub and more at Jelly button games
Redis : Database, cache, pub/sub and more at Jelly button gamesRedis : Database, cache, pub/sub and more at Jelly button games
Redis : Database, cache, pub/sub and more at Jelly button games
Redis Labs
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
valuebound
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
botsplash.com
 
MongoDB and DynamoDB
MongoDB and DynamoDBMongoDB and DynamoDB
MongoDB and DynamoDB
Md. Minhazul Haque
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
HabileLabs
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
Norberto Leite
 
Migrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at FacebookMigrating from InnoDB and HBase to MyRocks at Facebook
Migrating from InnoDB and HBase to MyRocks at Facebook
MariaDB plc
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB Performance
Tim Callaghan
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22nd
Ido Shilon
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger Overview
WiredTiger
 
MongoDB London PHP
MongoDB London PHPMongoDB London PHP
MongoDB London PHP
Mike Dirolf
 
Mongo db3.0 wired_tiger_storage_engine
Mongo db3.0 wired_tiger_storage_engineMongo db3.0 wired_tiger_storage_engine
Mongo db3.0 wired_tiger_storage_engine
Kenny Gorman
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
Pantheon
 
Redis : Database, cache, pub/sub and more at Jelly button games
Redis : Database, cache, pub/sub and more at Jelly button gamesRedis : Database, cache, pub/sub and more at Jelly button games
Redis : Database, cache, pub/sub and more at Jelly button games
Redis Labs
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
valuebound
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
botsplash.com
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
HabileLabs
 

Viewers also liked (11)

ColdFusion Features for More Modern Coding
ColdFusion Features for More Modern CodingColdFusion Features for More Modern Coding
ColdFusion Features for More Modern Coding
ColdFusionConference
 
Cold fusion Security-How to Secure Coldfusion Server
Cold fusion Security-How to Secure Coldfusion ServerCold fusion Security-How to Secure Coldfusion Server
Cold fusion Security-How to Secure Coldfusion Server
Mindfire Solutions
 
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
ColdFusionConference
 
Apache spark core
Apache spark coreApache spark core
Apache spark core
Thành Nguyễn
 
Building ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsBuilding ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS Applications
ColdFusionConference
 
10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world
ColdFusionConference
 
Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016
ColdFusionConference
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
ColdFusionConference
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
ColdFusionConference
 
CommandBox : Free CFML
CommandBox : Free CFMLCommandBox : Free CFML
CommandBox : Free CFML
Ortus Solutions, Corp
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
ColdFusion Features for More Modern Coding
ColdFusion Features for More Modern CodingColdFusion Features for More Modern Coding
ColdFusion Features for More Modern Coding
ColdFusionConference
 
Cold fusion Security-How to Secure Coldfusion Server
Cold fusion Security-How to Secure Coldfusion ServerCold fusion Security-How to Secure Coldfusion Server
Cold fusion Security-How to Secure Coldfusion Server
Mindfire Solutions
 
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
ColdFusionConference
 
Building ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsBuilding ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS Applications
ColdFusionConference
 
10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world10 Reasons ColdFusion PDFs should rule the world
10 Reasons ColdFusion PDFs should rule the world
ColdFusionConference
 
Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016
ColdFusionConference
 
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
ColdFusionConference
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
Ad

Similar to Using NoSQL MongoDB with ColdFusion (20)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
MongoDB is the MashupDB
MongoDB is the MashupDBMongoDB is the MashupDB
MongoDB is the MashupDB
Wynn Netherland
 
Using MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryUsing MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content Repository
MongoDB
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
Sigit52
 
Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
Shreyashkumar Nangnurwar
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
BigBlueHat
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
Kelum Senanayake
 
MongoDB
MongoDBMongoDB
MongoDB
fsbrooke
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
Corey Butler
 
No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용
Byeongweon Moon
 
MyRocks introduction and production deployment
MyRocks introduction and production deploymentMyRocks introduction and production deployment
MyRocks introduction and production deployment
Yoshinori Matsunobu
 
Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0
Jeremy Likness
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouch
Wynn Netherland
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
Tony Tam
 
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBSilicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Manish Pandit
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
Jeff Douglas
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
Appirio
 
NoSQL
NoSQLNoSQL
NoSQL
dbulic
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
Using MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content RepositoryUsing MongoDB to Build a Fast and Scalable Content Repository
Using MongoDB to Build a Fast and Scalable Content Repository
MongoDB
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
Sigit52
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
BigBlueHat
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
Kelum Senanayake
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
Corey Butler
 
No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용
Byeongweon Moon
 
MyRocks introduction and production deployment
MyRocks introduction and production deploymentMyRocks introduction and production deployment
MyRocks introduction and production deployment
Yoshinori Matsunobu
 
Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0
Jeremy Likness
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby
 
MongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouchMongoDB - Ruby document store that doesn't rhyme with ouch
MongoDB - Ruby document store that doesn't rhyme with ouch
Wynn Netherland
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
HabileLabs
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
Tony Tam
 
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDBSilicon Valley Code Camp: 2011 Introduction to MongoDB
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Manish Pandit
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
Jeff Douglas
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
Appirio
 
Ad

Recently uploaded (20)

2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 

Using NoSQL MongoDB with ColdFusion

  • 1. NoSQL with ColdFusion Using MongoDB Indy Nagpal CFObjective, Melbourne, 2011
  • 3. About me ✴ Straker Translations, New Zealand ✴ Been working with CF for a while now ✴ Cloud-based applications using Railo ✴ Love CFWheels ✴ nagpals.com/blog, @indynagpal
  • 5. NoSQL? ✴ Different things to different people ✴ Non-Relational rather than NoSQL ✴ System for storage/retrieval of data ✴ Persistence layer is not a responsibility of a single system
  • 7. Why NoSQL? ✴ 100s of millions of items in a big table
  • 8. Why NoSQL? ✴ 100s of millions of items in a big table ✴ Dynamic data structure
  • 10. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 11. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 12. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 13. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 14. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 15. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 16. SQL NoSQL Static Data Structure Dynamic Data Structure Dynamic Query Static Query (generally) Consistency Eventual consistency Transactions Limited Transactions Difficult to distribute Distributed, fault-tolerant Limited performance under load Optimized for heavy read-write
  • 18. NoSQL DBs ✴ Used with CF ✴ Apache CouchDB ✴ MongoDB ✴ Amazon SimpleDB ✴ CF/Java Wrappers available
  • 20. What is MongoDB ✴ A Document-oriented database ✴ “Humongous” ✴ Scalable, high-performance, open-source ✴ An alternative to relational databases ✴ One of the NoSQL technologies
  • 22. Key Difference ✴ Most No-SQL databases ✴ dynamic data ✴ static queries ✴ MongoDB ✴ dynamic data ✴ dynamic and static queries
  • 24. Basic Concepts ✴ Database
  • 25. Basic Concepts ✴ Database ✴ Collections (broadly like table)
  • 26. Basic Concepts ✴ Database ✴ Collections (broadly like table) ✴ Documents (like row)
  • 27. Basic Concepts ✴ Database ✴ Collections (broadly like table) ✴ Documents (like row) ✴ Fields (like columns)
  • 28. Basic Concepts ✴ Database ✴ Collections (broadly like table) ✴ Documents (like row) ✴ Fields (like columns) ✴ Collections are indexed
  • 29. Basic Concepts ✴ Database ✴ Collections (broadly like table) ✴ Documents (like row) ✴ Fields (like columns) ✴ Collections are indexed ✴ Cursors (retrieve data as required)
  • 31. Concepts ✴ New terminology ✴ Similar ideas, but not identical ✴ RDBMS - columns defined for tables ✴ NoSQL - fields defined for documents ✴ Collections are more like containers
  • 33. Drivers ✴ Officially supported drivers ✴ Language-specific drivers (Java, Ruby, etc.) ✴ Framework-specific (MongoMapper) ✴ Wrappers built on top of drivers ✴ cfmongodb built on Java drivers ✴ Unlike Apache CouchDB that uses REST
  • 34. BSON
  • 35. BSON ✴ Binary JSON format ✴ Supports embedding of documents and arrays within other documents and arrays ✴ Lightweight ✴ Traversable ✴ Efficient ✴ bsonspec.org
  • 37. CF and Mongo ✴ cfmongodb (on Github) -- excellent ✴ Wrapper around Java drivers ✴ Most functionality encapsulated ✴ Inserts, updates, delete, find ✴ Map-reduce, Geospatial
  • 38. CF and BSON • Structs/arrays persisted as they are! people = mongo.getDBCollection(“people”) person = { “fname” : “John”, “lname” : “Doe” } people.save(person)
  • 39. Init
  • 40. Init mongoConfig = createObject( 'component', 'cfmongodb.core.MongoConfig').init(dbName="test")
  • 41. Init mongoConfig = createObject( 'component', 'cfmongodb.core.MongoConfig').init(dbName="test") mongo = createObject('component', 'cfmongodb.core.Mongo').init(mongoConfig)
  • 42. Init mongoConfig = createObject( 'component', 'cfmongodb.core.MongoConfig').init(dbName="test") mongo = createObject('component', 'cfmongodb.core.Mongo').init(mongoConfig) people = mongo.getDBCollection('people')
  • 44. Add Data // create some data newPeople = []
  • 45. Add Data // create some data newPeople = [] arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘[email protected]’})
  • 46. Add Data // create some data newPeople = [] arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘[email protected]’}) arrayAppend(newPeople, {‘fname’: ‘Jane’, ‘lname’ : ‘Doe’})
  • 47. Add Data // create some data newPeople = [] arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘[email protected]’}) arrayAppend(newPeople, {‘fname’: ‘Jane’, ‘lname’ : ‘Doe’}) // save everything at once people.saveAll(newPeople)
  • 49. Find / Update person = people.query().$eq("fname", "Jane").find()
  • 50. Find / Update person = people.query().$eq("fname", "Jane").find() // update a record person[“email”] = “[email protected]” person.update(person)
  • 51. Tools
  • 52. Tools ✴ Terminal console ✴ MongoHub (Mac) ✴ MongoExplorer, MongoVision (Windows) ✴ SSH Tunnel to connect ✴ mongohq.com (hosted MongoDB/admin)
  • 54. MongoDB and Railo ✴ Railo Extension ✴ Cache CF variables/data ✴ Store key-value pairs ✴ cacheGet() ✴ cachePut()
  • 56. Queries and Map- reduce ✴ Queries - rapid development ✴ Map-reduce - advanced querying ✴ Query and Map-reduce together give MongoDB an edge over other NoSQL alternatives
  • 58. Data Modeling ✴ No Joins! Scary? ✴ Embedding documents supported via ID ✴ Big mind shift ✴ ‘Fear’ of duplicate data drives design decisions in relational db world
  • 60. CF ORM ✴ No support in CF ORM frameworks ✴ Other language frameworks more advanced ✴ Ruby on Rails - mongomapper ✴ Need ORM integration for wider adoption
  • 62. Asynchronous ✴ Asynchronous inserts/updates ✴ Journaled ✴ Capped Collections (FIFO)
  • 63. Time taken to add 20,000 records with 5 words in each record 30 25 Time in Seconds 20 15 10 5 0 mysql (cfquery) filesystem (cflog) mongodb (cfmongodb)
  • 65. Compelling features ✴ On-demand database and collection creation ✴ Asynchronous writes ✴ Replication - simple and easy ✴ Large-scale data processing ✴ Sharding - horizontal scaling ✴ Geospatial indexes
  • 67. When to use? ✴ Relational DBs suffice for most projects ✴ Abstraction via ORM is very useful ✴ MongoDB -- alternative/add-on ✴ Removes reliance on only one data storage mechanism
  • 69. Learning Curve ✴ Syntax ✴ Concepts like sharding, replication ✴ Well-documented / blogged ✴ Active mailing list ✴ Being used in production
  • 70. So...
  • 71. So... ✴ Another tool to have in one’s kit ✴ Extremely useful and easy to use ✴ Worth spending some time on
  • 72. Thank you! @indynagpal [email protected] http://nagpals.com/blog

Editor's Notes