SlideShare a Scribd company logo
1 of 72
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
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

More Related Content

What's hot

MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger InternalsNorberto 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 FacebookMariaDB plc
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceTim Callaghan
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22ndIdo Shilon
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger OverviewWiredTiger
 
MongoDB London PHP
MongoDB London PHPMongoDB London PHP
MongoDB London PHPMike 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_engineKenny Gorman
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale WebinarPantheon
 
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 gamesRedis Labs
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDBvaluebound
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsHabilelabs
 

What's hot (20)

MongoDB
MongoDBMongoDB
MongoDB
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
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
 
Is It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB PerformanceIs It Fast? : Measuring MongoDB Performance
Is It Fast? : Measuring MongoDB Performance
 
Lokijs
LokijsLokijs
Lokijs
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22nd
 
WiredTiger Overview
WiredTiger OverviewWiredTiger Overview
WiredTiger Overview
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
MongoDB London PHP
MongoDB London PHPMongoDB London PHP
MongoDB London PHP
 
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
 
WordPress at Scale Webinar
WordPress at Scale WebinarWordPress at Scale Webinar
WordPress at Scale Webinar
 
Intro Couchdb
Intro CouchdbIntro Couchdb
Intro Couchdb
 
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
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
MongoDB and DynamoDB
MongoDB and DynamoDBMongoDB and DynamoDB
MongoDB and DynamoDB
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
 

Viewers also liked

ColdFusion Features for More Modern Coding
ColdFusion Features for More Modern CodingColdFusion Features for More Modern Coding
ColdFusion Features for More Modern CodingColdFusionConference
 
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 ServerMindfire 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 ApplicationsColdFusionConference
 
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 worldColdFusionConference
 
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 2016ColdFusionConference
 
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 coldfusionColdFusionConference
 
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 #3XEDigitalAleyda Solís
 

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
 
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
 
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...
 
Apache spark core
Apache spark coreApache spark core
Apache spark core
 
Building ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS ApplicationsBuilding ColdFusion And AngularJS Applications
Building ColdFusion And AngularJS Applications
 
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
 
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
 
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
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
CommandBox : Free CFML
CommandBox : Free CFMLCommandBox : Free CFML
CommandBox : Free CFML
 
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
 

Similar to Using NoSQL MongoDB with ColdFusion

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin 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 RepositoryMongoDB
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptxSigit52
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and HowBigBlueHat
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionKelum Senanayake
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App ArchitectureCorey 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 deploymentYoshinori 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.0Jeremy Likness
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
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 ouchWynn Netherland
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relationalTony 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 MongoDBManish Pandit
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012Appirio
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBJeff Douglas
 

Similar to Using NoSQL MongoDB with ColdFusion (20)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB is the MashupDB
MongoDB is the MashupDBMongoDB is the MashupDB
MongoDB is the MashupDB
 
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.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
 
Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
 
MongoDB
MongoDBMongoDB
MongoDB
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
 
No sql solutions - 공개용
No sql solutions - 공개용No sql solutions - 공개용
No sql solutions - 공개용
 
MyRocks introduction and production deployment
MyRocks introduction and production deploymentMyRocks introduction and production deployment
MyRocks introduction and production deployment
 
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
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
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
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
 
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
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
 
NoSQL
NoSQLNoSQL
NoSQL
 

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

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
  • 9.
  • 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’ : ‘john@doe.com’})
  • 46. Add Data // create some data newPeople = [] arrayAppend(newPeople, {‘fname’: ‘John’, ‘email’ : ‘john@doe.com’}) arrayAppend(newPeople, {‘fname’: ‘Jane’, ‘lname’ : ‘Doe’})
  • 47. 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)
  • 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”] = “jane@doe.com” 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 indy@nagpals.com http://nagpals.com/blog

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. Two application problems:\n\nApplication 1: \n100s of millions of rows being written in clustered CF app\nSingle table with fixed number of columns\nMysql works, but slows down\nNo replication\n\nApplication 2\nApplication to generate mini applications, where number of columns can differ from each mini application to mini application\nBasic analytics needed\n\n
  12. Two application problems:\n\nApplication 1: \n100s of millions of rows being written in clustered CF app\nSingle table with fixed number of columns\nMysql works, but slows down\nNo replication\n\nApplication 2\nApplication to generate mini applications, where number of columns can differ from each mini application to mini application\nBasic analytics needed\n\n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n