SlideShare a Scribd company logo
open-source, high-performance,
schema-free, document-oriented
           database



                       http://www.mongodb.org/
The Web framework for perfectionists
           with deadlines




                        http://www.djangoproject.com/
MongoDB hearts Django? (Django NYC)
“One size fits all”
   no longer
                               RDBMS
                          (Oracle, MySQL)




                                      Non-relational
 New gen. OLAP
 (vertica, aster, greenplum)         operational stores
                                            (“NoSQL”)
NoSQL really means:

non-relational next generation
operational datastores and databases
Scaling out
no joins +
light transactional semantics =
  horizontally scalable architectures
Data models
no joins +
light transactional semantics =
  horizontally scalable architectures

important side effect :
 new data models =
  improved ways to develop
applications
Data models
Key/value
 memcached, dynamo, voldemort


Tabular
 bigtable, cassandra, hbase, hypertable


Document-oriented
 couchdb,
MongoDB hearts Django? (Django NYC)
MongoDB in two minutes
• Documents (think rows) are dicts:
            {“hello”: “world”}
  {“hello”: “world”, “foo”: [{“bar”: 1}]}
• Collections (think tables) are schema-free
• Queries are dynamic
• Great single node performance
• Built in replication and auto-sharding
• No complex transactions
?
Yes...
 ...but also sometimes no
Similar to                            +
• A lot of Django doesn’t depend on django.db:
 • URL dispatch, templates, I18N, caching, etc.
• Some things do:
 • Models
 • Auth
 • Sessions
 • Admin
settings.py
DATABASE_ENGINE = ''
DATABASE_NAME = ''
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''

MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
# 'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
)

INSTALLED_APPS = (
# 'django.contrib.auth',
  'django.contrib.contenttypes',
# 'django.contrib.sessions',
  'django.contrib.sites',
)
Representing a Poll

{'question': 'Do MongoDB + Django <3 each other?',
 'pub_date': datetime.datetime(2010, 1, 21),
 'choices': [{'votes': 35, 'choice': 'Yes!'},
         {'votes': 2, 'choice': 'No...'}]}
models.py (PyMongo)
def save_poll(question):
  return db.polls.insert({"question": question,
                  "pub_date": datetime.utcnow()})

def all_polls():
  return db.polls.find()

def add_choice(poll_id, choice):
  db.polls.update({"_id": poll_id},
            {"$push": {"choices": {"choice": choice,
                            "votes": 0}}})

def add_vote(poll_id, choice):
  db.polls.update({"_id": poll_id},
            {"$inc": {"choices.%d.votes" % choice: 1}})
                                              http://api.mongodb.org/python
models.py (MongoKit)

class Poll(mongokit.Document):
   structure = {"question": str,
            "pub_date": datetime,
            "choices": [{"choice": str,
                    "votes": int}]}
   required_fields = ["question"]
   default_values = {"pub_date": datetime.utcnow()}




                               http://bytebucket.org/namlook/mongokit
models.py (Ming)
class Poll(ming.Document):

  class __mongometa__:
     session = session
     name = "polls"

  _id = ming.Field(ming.schema.ObjectId)
  question = ming.Field(str, required=True)
  pub_date = ming.Field(datetime.datetime,
           if_missing=datetime.datetime.utcnow)
  choices = ming.Field([{"choice": str,
                 "votes": int}])

                                http://merciless.sourceforge.net/
mango - sessions and auth


•   Full sessions support
•   mango provided User class
    •   supports is_authenticated(), set_password(), etc.




                                   http://github.com/vpulim/mango
mango - sessions and auth


SESSION_ENGINE = 'mango.session'
AUTHENTICATION_BACKENDS = ('mango.auth.Backend',)
MONGODB_HOST = 'localhost'
MONGODB_PORT = None
MONGODB_NAME = 'mydb'




                            http://github.com/vpulim/mango
What about admin?

• No great solution... yet.
• Could replace admin app like mango does
  for sessions / auth
• Or...
Supporting MongoDB
        in django.db
•   Best solution (long term)

•   http://bitbucket.org/kpot/django-mongodb/

•   http://bitbucket.org/wkornewald/django-nonrel/

•   http://code.djangoproject.com/wiki/NonSqlBackends
1. Download MongoDB
   http://www.mongodb.org

2. Try it out!

3. (And help us make things work better with
   Django!)
• http://www.mongodb.org
• irc.freenode.net#mongodb
• mongodb-user on google groups
• @mongodb, @mdirolf
• mike@10gen.com
• http://www.slideshare.net/mdirolf
• http://github.com/mdirolf/djanMon/

More Related Content

What's hot (20)

PPTX
JS basics
Mohd Saeed
 
PPTX
Introduction to Parse backend for mobile developers
Grigor Yeghiazaryan
 
PDF
N hidden gems in hippo forge and experience plugins (dec17)
Woonsan Ko
 
PPTX
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
KEY
Practical Use of MongoDB for Node.js
async_io
 
PDF
Suggest.js
Mohd Saeed
 
PPTX
Azure F#unctions
☁️ Mikhail Shilkov
 
PPTX
JavaScript and jQuery Basics
Kaloyan Kosev
 
PPTX
Getting Started with Javascript
Akshay Mathur
 
PDF
Lec 7
maamir farooq
 
PPTX
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Ayes Chinmay
 
PDF
WebApps e Frameworks Javascript
meet2Brains
 
PDF
Introduction to Backbone.js for Rails developers
AoteaStudios
 
PPTX
JavaScript Basics
Dina Goldshtein
 
PDF
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
camp_drupal_ua
 
PDF
JavaScript and BOM events
Jussi Pohjolainen
 
PPTX
Mongoose and MongoDB 101
Will Button
 
PPTX
Getting Started with Web
Akshay Mathur
 
PPTX
Mongo - an intermediate introduction
nklmish
 
PDF
Mongoose: MongoDB object modelling for Node.js
Yuriy Bogomolov
 
JS basics
Mohd Saeed
 
Introduction to Parse backend for mobile developers
Grigor Yeghiazaryan
 
N hidden gems in hippo forge and experience plugins (dec17)
Woonsan Ko
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Practical Use of MongoDB for Node.js
async_io
 
Suggest.js
Mohd Saeed
 
Azure F#unctions
☁️ Mikhail Shilkov
 
JavaScript and jQuery Basics
Kaloyan Kosev
 
Getting Started with Javascript
Akshay Mathur
 
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Ayes Chinmay
 
WebApps e Frameworks Javascript
meet2Brains
 
Introduction to Backbone.js for Rails developers
AoteaStudios
 
JavaScript Basics
Dina Goldshtein
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
camp_drupal_ua
 
JavaScript and BOM events
Jussi Pohjolainen
 
Mongoose and MongoDB 101
Will Button
 
Getting Started with Web
Akshay Mathur
 
Mongo - an intermediate introduction
nklmish
 
Mongoose: MongoDB object modelling for Node.js
Yuriy Bogomolov
 

Viewers also liked (8)

PPTX
Mango Database - Web Development
mssaman
 
PDF
Mongo db eveningschemadesign
MongoDB APAC
 
PPT
Mongo db basics
Dhaval Mistry
 
PPTX
MongoDB Schema Design by Examples
Hadi Ariawan
 
PDF
Building a Social Network with MongoDB
Fred Chu
 
KEY
Modeling Data in MongoDB
lehresman
 
PPT
MongoDB Schema Design
MongoDB
 
PPTX
MongoDB Schema Design: Four Real-World Examples
Mike Friedman
 
Mango Database - Web Development
mssaman
 
Mongo db eveningschemadesign
MongoDB APAC
 
Mongo db basics
Dhaval Mistry
 
MongoDB Schema Design by Examples
Hadi Ariawan
 
Building a Social Network with MongoDB
Fred Chu
 
Modeling Data in MongoDB
lehresman
 
MongoDB Schema Design
MongoDB
 
MongoDB Schema Design: Four Real-World Examples
Mike Friedman
 
Ad

Similar to MongoDB hearts Django? (Django NYC) (20)

KEY
Python Development (MongoSF)
Mike Dirolf
 
KEY
Inside PyMongo - MongoNYC
Mike Dirolf
 
KEY
MongoDB EuroPython 2009
Mike Dirolf
 
KEY
MongoDB NYC Python
Mike Dirolf
 
PDF
Introduction to Django
Jagdeep Singh Malhi
 
PDF
REST Web API with MongoDB
MongoDB
 
PDF
MongoDB: a gentle, friendly overview
Antonio Pintus
 
PPT
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rick Copeland
 
KEY
MongoDB SF Python
Mike Dirolf
 
PDF
MongoDB Basics
Sarang Shravagi
 
PDF
Django mongodb -djangoday_
WEBdeBS
 
KEY
MongoDB at RuPy
Mike Dirolf
 
PDF
Django Mongodb Engine
Flavio Percoco Premoli
 
PDF
Pyconie 2012
Yaqi Zhao
 
ODP
Python and MongoDB
Christiano Anderson
 
PDF
Python & Django TTT
kevinvw
 
PPT
Django and Mongoengine
austinpublic
 
PPT
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Rick Copeland
 
PDF
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB
 
PPT
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rick Copeland
 
Python Development (MongoSF)
Mike Dirolf
 
Inside PyMongo - MongoNYC
Mike Dirolf
 
MongoDB EuroPython 2009
Mike Dirolf
 
MongoDB NYC Python
Mike Dirolf
 
Introduction to Django
Jagdeep Singh Malhi
 
REST Web API with MongoDB
MongoDB
 
MongoDB: a gentle, friendly overview
Antonio Pintus
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rick Copeland
 
MongoDB SF Python
Mike Dirolf
 
MongoDB Basics
Sarang Shravagi
 
Django mongodb -djangoday_
WEBdeBS
 
MongoDB at RuPy
Mike Dirolf
 
Django Mongodb Engine
Flavio Percoco Premoli
 
Pyconie 2012
Yaqi Zhao
 
Python and MongoDB
Christiano Anderson
 
Python & Django TTT
kevinvw
 
Django and Mongoengine
austinpublic
 
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Rick Copeland
 
MongoDB World 2016: From the Polls to the Trolls: Seeing What the World Think...
MongoDB
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rick Copeland
 
Ad

More from Mike Dirolf (13)

PDF
Indexing
Mike Dirolf
 
PDF
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 
PDF
FrozenRails Training
Mike Dirolf
 
PDF
MongoDB at FrozenRails
Mike Dirolf
 
PDF
Introduction to MongoDB
Mike Dirolf
 
KEY
MongoDB: How it Works
Mike Dirolf
 
KEY
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
 
PDF
MongoDB at RubyConf
Mike Dirolf
 
KEY
MongoDB at RubyEnRails 2009
Mike Dirolf
 
KEY
MongoDB Strange Loop 2009
Mike Dirolf
 
KEY
MongoDB Hadoop DC
Mike Dirolf
 
KEY
MongoDB London PHP
Mike Dirolf
 
KEY
MongoDB SF Ruby
Mike Dirolf
 
Indexing
Mike Dirolf
 
Inside MongoDB: the Internals of an Open-Source Database
Mike Dirolf
 
FrozenRails Training
Mike Dirolf
 
MongoDB at FrozenRails
Mike Dirolf
 
Introduction to MongoDB
Mike Dirolf
 
MongoDB: How it Works
Mike Dirolf
 
MongoDB at CodeMash 2.0.1.0
Mike Dirolf
 
MongoDB at RubyConf
Mike Dirolf
 
MongoDB at RubyEnRails 2009
Mike Dirolf
 
MongoDB Strange Loop 2009
Mike Dirolf
 
MongoDB Hadoop DC
Mike Dirolf
 
MongoDB London PHP
Mike Dirolf
 
MongoDB SF Ruby
Mike Dirolf
 

Recently uploaded (20)

PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
NASA A Researcher’s Guide to International Space Station : Earth Observations
Dr. PANKAJ DHUSSA
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
NASA A Researcher’s Guide to International Space Station : Earth Observations
Dr. PANKAJ DHUSSA
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
NASA A Researcher’s Guide to International Space Station : Fundamental Physics
Dr. PANKAJ DHUSSA
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 

MongoDB hearts Django? (Django NYC)

  • 1. open-source, high-performance, schema-free, document-oriented database http://www.mongodb.org/
  • 2. The Web framework for perfectionists with deadlines http://www.djangoproject.com/
  • 4. “One size fits all” no longer RDBMS (Oracle, MySQL) Non-relational New gen. OLAP (vertica, aster, greenplum) operational stores (“NoSQL”)
  • 5. NoSQL really means: non-relational next generation operational datastores and databases
  • 6. Scaling out no joins + light transactional semantics = horizontally scalable architectures
  • 7. Data models no joins + light transactional semantics = horizontally scalable architectures important side effect : new data models = improved ways to develop applications
  • 8. Data models Key/value memcached, dynamo, voldemort Tabular bigtable, cassandra, hbase, hypertable Document-oriented couchdb,
  • 10. MongoDB in two minutes • Documents (think rows) are dicts: {“hello”: “world”} {“hello”: “world”, “foo”: [{“bar”: 1}]} • Collections (think tables) are schema-free • Queries are dynamic • Great single node performance • Built in replication and auto-sharding • No complex transactions
  • 11. ?
  • 12. Yes... ...but also sometimes no
  • 13. Similar to + • A lot of Django doesn’t depend on django.db: • URL dispatch, templates, I18N, caching, etc. • Some things do: • Models • Auth • Sessions • Admin
  • 14. settings.py DATABASE_ENGINE = '' DATABASE_NAME = '' DATABASE_USER = '' DATABASE_PASSWORD = '' DATABASE_HOST = '' DATABASE_PORT = '' MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', # 'django.contrib.sessions.middleware.SessionMiddleware', # 'django.contrib.auth.middleware.AuthenticationMiddleware', ) INSTALLED_APPS = ( # 'django.contrib.auth', 'django.contrib.contenttypes', # 'django.contrib.sessions', 'django.contrib.sites', )
  • 15. Representing a Poll {'question': 'Do MongoDB + Django <3 each other?', 'pub_date': datetime.datetime(2010, 1, 21), 'choices': [{'votes': 35, 'choice': 'Yes!'}, {'votes': 2, 'choice': 'No...'}]}
  • 16. models.py (PyMongo) def save_poll(question): return db.polls.insert({"question": question, "pub_date": datetime.utcnow()}) def all_polls(): return db.polls.find() def add_choice(poll_id, choice): db.polls.update({"_id": poll_id}, {"$push": {"choices": {"choice": choice, "votes": 0}}}) def add_vote(poll_id, choice): db.polls.update({"_id": poll_id}, {"$inc": {"choices.%d.votes" % choice: 1}}) http://api.mongodb.org/python
  • 17. models.py (MongoKit) class Poll(mongokit.Document): structure = {"question": str, "pub_date": datetime, "choices": [{"choice": str, "votes": int}]} required_fields = ["question"] default_values = {"pub_date": datetime.utcnow()} http://bytebucket.org/namlook/mongokit
  • 18. models.py (Ming) class Poll(ming.Document): class __mongometa__: session = session name = "polls" _id = ming.Field(ming.schema.ObjectId) question = ming.Field(str, required=True) pub_date = ming.Field(datetime.datetime, if_missing=datetime.datetime.utcnow) choices = ming.Field([{"choice": str, "votes": int}]) http://merciless.sourceforge.net/
  • 19. mango - sessions and auth • Full sessions support • mango provided User class • supports is_authenticated(), set_password(), etc. http://github.com/vpulim/mango
  • 20. mango - sessions and auth SESSION_ENGINE = 'mango.session' AUTHENTICATION_BACKENDS = ('mango.auth.Backend',) MONGODB_HOST = 'localhost' MONGODB_PORT = None MONGODB_NAME = 'mydb' http://github.com/vpulim/mango
  • 21. What about admin? • No great solution... yet. • Could replace admin app like mango does for sessions / auth • Or...
  • 22. Supporting MongoDB in django.db • Best solution (long term) • http://bitbucket.org/kpot/django-mongodb/ • http://bitbucket.org/wkornewald/django-nonrel/ • http://code.djangoproject.com/wiki/NonSqlBackends
  • 23. 1. Download MongoDB http://www.mongodb.org 2. Try it out! 3. (And help us make things work better with Django!)
  • 24. • http://www.mongodb.org • irc.freenode.net#mongodb • mongodb-user on google groups • @mongodb, @mdirolf • [email protected] • http://www.slideshare.net/mdirolf • http://github.com/mdirolf/djanMon/

Editor's Notes

  • #24: blog post twitter