SlideShare a Scribd company logo
1 of 28
Rick Copeland @rick446
Arborian Consulting, LLC
http://www.flickr.com/photos/fazen/9079179/
-   Get started with PyMongo


-   Sprinkle in some Ming schemas


-   ODM: When a dict just won’t do
>>>importpymongo
>>>conn = pymongo.Connection()
>>>conn
Connection('localhost', 27017)
>>>conn.test
Database(Connection('localhost', 27017), u'test')
>>>conn.test.foo
Collection(Database(Connection('localhost', 27017), u'test'), u'foo')
>>>conn['test-db']
Database(Connection('localhost', 27017), u'test-db')
>>>conn['test-db']['foo-collection']
Collection(Database(Connection('localhost', 27017), u'test-db'), u'foo-
  collection')
>>>conn.test.foo.bar.baz
Collection(Database(Connection('localhost', 27017), u'test'), u'foo.bar.baz')
>>>db = conn.test
>>>id = db.foo.insert({'bar':1, 'baz':[ 1, 2, {'k':5} ] })
>>>id
ObjectId('4e712e21eb033009fa000000')                          Auto-Generated _id
>>>db.foo.find()
<pymongo.cursor.Cursor object at 0x29c7d50>
>>>list(db.foo.find())                                             Cursors are python
[{u'bar': 1, u'_id': ObjectId('4e712e21eb033009fa000000'), u'baz': [1, 2, {'k': 5}]}]
                                                                       generators
>>>db.foo.update({'_id':id}, {'$set': { 'bar':2}})
>>>db.foo.find().next()
{u'bar': 2, u'_id': ObjectId('4e712e21eb033009fa000000'), u'baz': [1, 2, {'k': 5}]}
>>>db.foo.remove({'_id':id})
>>>list(db.foo.find())
[]
                                                             Remove uses same
                                                           query language as find()
>>>db.foo.insert([ dict(x=x) forxinrange(10) ])
[ObjectId('4e71313aeb033009fa00000b'), … ]
>>>list(db.foo.find({ 'x': {'$gt': 3} }))                                    Range Query
[{u'x': 4, u'_id': ObjectId('4e71313aeb033009fa00000f')}, {u'x': 5, u'_id':
     ObjectId('4e71313aeb033009fa000010')}, {u'x': 6, u'_id':
     ObjectId('4e71313aeb033009fa000011')}, …]
>>>list(db.foo.find({ 'x': {'$gt': 3} }, { '_id':0 } ))
[{u'x': 4}, {u'x': 5}, {u'x': 6}, {u'x': 7}, {u'x': 8}, {u'x': 9}]
>>>list(db.foo.find({ 'x': {'$gt': 3} }, { '_id':0 } )
....skip(1).limit(2))
[{u'x': 5}, {u'x': 6}]
>>>db.foo.ensure_index([
                                                                   Partial Retrieval
...('x’,pymongo.ASCENDING),('y’,pymongo.DESCENDING)])
u'x_1_y_-1’


                                                      Compound Indexes
One Rule (for now): Avoid Javascript

                                       http://www.flickr.com/photos/lizjones/295567490/
   You gotta write Javascript (for now)

   It’s pretty slow (single-threaded JS engine) 
                                                    MongoDB 2.2 with New
   Javascript is used by                           Aggregation Framework
     $where in a query                            Coming Real Soon Now ™
     .group(key, condition, initial, reduce, finalize=None)
     .map_reduce(map, reduce, out, finalize=None, …)


   Sharding gives some parallelism with .map_reduce() (and
    possibly ‘$where’). Otherwise you’re single threaded.
>>>importgridfs
>>>fs = gridfs.GridFS(db)                           Python context
>>>withfs.new_file() asfp:                             manager
... fp.write('The file')
...
>>>fp
<gridfs.grid_file.GridIn object at 0x2cae910>
>>>fp._id
ObjectId('4e727f64eb03300c0b000003')            Retrieve file by _id
>>>fs.get(fp._id).read()
'The file'

     Arbitrary data can be stored in the ‘fp’ object – it’s
      just a Document (but please put it in ‘fp.metadata’)
         Mime type, links to other docs, etc.
>>>file_id = fs.put('Moar data!', filename='foo.txt')
>>>fs.get_last_version('foo.txt').read()
'Moar data!’
                                                                         Create file by
                                                                           filename
>>>file_id = fs.put('Evenmoar data!', filename='foo.txt')
>>>fs.get_last_version('foo.txt').read()
'Even moar data!’
>>>fs.get_version('foo.txt', -2).read()
'Moar data!’
>>>fs.list()
                                                            “2nd from the last”
[u'foo.txt']
>>>fs.delete(fs.get_last_version('foo.txt')._id)
>>>fs.list()
[u'foo.txt']
>>>fs.delete(fs.get_last_version('foo.txt')._id)
>>>fs.list()
[]
-   Get started with PyMongo


-   Sprinkle in some Ming schemas


-   ODM: When a dict just won’t do
   Your data has a schema
       Your database can define and enforce it
       It can live in your application (as with MongoDB)
       Nice to have the schema defined in one place in the code


   Sometimes you need a “migration”
       Changing the structure/meaning of fields
       Adding indexes, particularly unique indexes
       Sometimes lazy, sometimes eager


   “Unit of work:” Queuing up all your updates can be handy
Model              Datastore
(schema)             (database)



           Session
>>>importming.datastore
>>>ds = ming.datastore.DataStore('mongodb://localhost:27017', database='test')
>>>ds.db                                                         Connection +
Database(Connection('localhost', 27017), u'test')                 Database
>>>session = ming.Session(ds)
>>>session.db
Database(Connection('localhost', 27017), u'test')
>>>ming.configure(**{                                          Optimized for config
... 'ming.main.master':'mongodb://localhost:27017',                   files
... 'ming.main.database':'test'})
>>>Session.by_name('main').db
Database(Connection(u'localhost', 27017), u'test')
http://www.flickr.com/photos/pictureclara/5333266789/
frommingimport schema, Field

WikiDoc= collection(‘wiki_page', session,
Field('_id', schema.ObjectId()),
                                                     Index created on
Field('title', str, index=True),
                                                         import
Field('text', str))

CommentDoc= collection(‘comment', session,
Field('_id', schema.ObjectId()),
Field('page_id', schema.ObjectId(), index=True),
Field('text', str))
                                                   Shorthand for
                                                   schema.String
frommingimport Document, Session, Field

classWikiDoc(Document):
class__mongometa__:
session=Session.by_name(’main')
name='wiki_page’
indexes=[ ('title') ]
title = Field(str)
text = Field(str)


   Old declarative syntax continues to exist and be
    supported, but it’s not being actively improved
   Sometimes nice when you want additional
    methods/attrs on your document class
>>>doc = WikiDoc(dict(title='Cats', text='I can hazcheezburger?'))
>>>doc.m.save()
>>>WikiDoc.m.find()
<ming.base.Cursor object at 0x2c2cd90>
>>>WikiDoc.m.find().all()                                       Documents are dict
                                                                     subclasses
[{'text': u'I can hazcheezburger?', '_id': ObjectId('4e727163eb03300c0b000001'),
     'title': u'Cats'}]
>>>WikiDoc.m.find().one().text
u'Ican hazcheezburger?’
>>>doc = WikiDoc(dict(tietul='LOL', text='Invisible bicycle'))
>>>doc.m.save()
Traceback(most recent call last):
File "<stdin>", line 1,
  …                                                        Exception pinpoints
ming.schema.Invalid: <class 'ming.metadata.Document<wiki_page>'>:
                                                                problem
Extra keys: set(['tietul'])
>>>ming.datastore.DataStore('mim://', database='test').db
mim.Database(test)



   MongoDB is (generally) fast
       … except when creating databases
       … particularly when you preallocate


   Unit tests like things to be isolated


   MIM gives you isolation at the expense of speed & scaling
-   Get started with PyMongo


-   Sprinkle in some Ming schemas


-   ODM: When a dict just won’t do
frommingimport schema, Field
fromming.odmimport (mapper, Mapper, RelationProperty,
ForeignIdProperty)
                                                          Plain Old Python
WikiDoc= collection('wiki_page',session, … )                   Classes
CommentDoc= collection(’comment’, session, … )

classWikiPage(object): pass                               Map classes to
classComment(object): pass                              collection + session
odmsession.mapper(WikiPage, WikiDoc, properties=dict(
comments=RelationProperty('WikiComment')))
odmsession.mapper(Comment, CommentDoc, properties=dict(
page_id=ForeignIdProperty('WikiPage'),
page=RelationProperty('WikiPage')))

                                                               “Relations”
classWikiPage(MappedClass):
class__mongometa__:
session = main_odm_session
name='wiki_page’
indexes = [ 'title']

    _id = FieldProperty(S.ObjectId)
title = FieldProperty(str)
text = FieldProperty(str)
comments = RelationProperty(’Comment’)
       Session ODMSession
       My_collection.m… My_mapped_class.query…
       ODMSessionactually does stuff
           Track object identity
           Track object modifications
           Unit of work flushing all changes at once
    >>>pg = WikiPage(title='MyPage', text='is here')
    >>>session.db.wiki_page.count()
    0
    >>>main_orm_session.flush()
    >>>session.db.wiki_page.count()
    1
http://www.flickr.com/photos/39747297@N05/5229733647/
   Various plug points in the session
       before_flush
       after_flush


   Some uses
       Logging changes to sensitive data or for analytics
       Full-text search indexing
       “last modified” fields
       Performance instrumentation
   Various plug points in the mapper
       before_/after_:
           Insert
           Update
           Delete
           Remove


   Some uses
       Collection/model-specific logging (user creation, etc.)
       Anything you might want a SessionExtension for but
        would rather do per-model
PyMongo
http://api.mongodb.org/python
Apache License



Ming
http://sf.net/projects/merciless/
MIT License
Rick Copeland @rick446
   Arborian Consulting, LLC




Feedback? http://www.surveymonkey.com/s/5DLCYKN

                              http://www.flickr.com/photos/f-oxymoron/5005673112/

More Related Content

What's hot

Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applicationsSkills Matter
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202Mahmoud Samir Fayed
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebChristian Baranowski
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196Mahmoud Samir Fayed
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMongoDB
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210Mahmoud Samir Fayed
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)MongoDB
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDBTakahiro Inoue
 
The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189Mahmoud Samir Fayed
 
Database madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyDatabase madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyJaime Buelta
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityMongoDB
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserHoward Lewis Ship
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31Mahmoud Samir Fayed
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query OptimizationMongoDB
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180Mahmoud Samir Fayed
 
Using Scala Slick at FortyTwo
Using Scala Slick at FortyTwoUsing Scala Slick at FortyTwo
Using Scala Slick at FortyTwoEishay Smith
 

What's hot (20)

Patterns for slick database applications
Patterns for slick database applicationsPatterns for slick database applications
Patterns for slick database applications
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
 
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und GebBDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
BDD - Behavior Driven Development Webapps mit Groovy Spock und Geb
 
Drupal 8 database api
Drupal 8 database apiDrupal 8 database api
Drupal 8 database api
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDBMythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
 
The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189
 
Database madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemyDatabase madness with_mongoengine_and_sql_alchemy
Database madness with_mongoengine_and_sql_alchemy
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and Creativity
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The Browser
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query Optimization
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180
 
Using Scala Slick at FortyTwo
Using Scala Slick at FortyTwoUsing Scala Slick at FortyTwo
Using Scala Slick at FortyTwo
 
MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 

Similar to Rapid and Scalable Development with MongoDB, PyMongo, and Ming

Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYCMike Dirolf
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Python Development (MongoSF)
Python Development (MongoSF)Python Development (MongoSF)
Python Development (MongoSF)Mike Dirolf
 
Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)MongoSF
 
Web Components With Rails
Web Components With RailsWeb Components With Rails
Web Components With RailsBoris Nadion
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수용 최
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...Functional Thursday
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database JonesJohn David Duncan
 
PyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialPyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialjbellis
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsLudmila Nesvitiy
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In PyEric ShangKuan
 
Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Michele Orselli
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
Lean React - Patterns for High Performance [ploneconf2017]
Lean React - Patterns for High Performance [ploneconf2017]Lean React - Patterns for High Performance [ploneconf2017]
Lean React - Patterns for High Performance [ploneconf2017]Devon Bernard
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11Henry Schreiner
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDBDoThinger
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesDoris Chen
 

Similar to Rapid and Scalable Development with MongoDB, PyMongo, and Ming (20)

Inside PyMongo - MongoNYC
Inside PyMongo - MongoNYCInside PyMongo - MongoNYC
Inside PyMongo - MongoNYC
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Python Development (MongoSF)
Python Development (MongoSF)Python Development (MongoSF)
Python Development (MongoSF)
 
Latinoware
LatinowareLatinoware
Latinoware
 
Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)
 
Web Components With Rails
Web Components With RailsWeb Components With Rails
Web Components With Rails
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 
Python 내장 함수
Python 내장 함수Python 내장 함수
Python 내장 함수
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database Jones
 
PyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorialPyCon 2010 SQLAlchemy tutorial
PyCon 2010 SQLAlchemy tutorial
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17Hopping in clouds - phpuk 17
Hopping in clouds - phpuk 17
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Lean React - Patterns for High Performance [ploneconf2017]
Lean React - Patterns for High Performance [ploneconf2017]Lean React - Patterns for High Performance [ploneconf2017]
Lean React - Patterns for High Performance [ploneconf2017]
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Starting with MongoDB
Starting with MongoDBStarting with MongoDB
Starting with MongoDB
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
 

More from Rick Copeland

Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Rick Copeland
 
Schema Design at Scale
Schema Design at ScaleSchema Design at Scale
Schema Design at ScaleRick Copeland
 
Building Your First MongoDB Application
Building Your First MongoDB ApplicationBuilding Your First MongoDB Application
Building Your First MongoDB ApplicationRick Copeland
 
Chef on MongoDB and Pyramid
Chef on MongoDB and PyramidChef on MongoDB and Pyramid
Chef on MongoDB and PyramidRick Copeland
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBRick Copeland
 
Chef on Python and MongoDB
Chef on Python and MongoDBChef on Python and MongoDB
Chef on Python and MongoDBRick Copeland
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioRick Copeland
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQRealtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQRick Copeland
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRick Copeland
 
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeAllura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeRick Copeland
 
MongoATL: How Sourceforge is Using MongoDB
MongoATL: How Sourceforge is Using MongoDBMongoATL: How Sourceforge is Using MongoDB
MongoATL: How Sourceforge is Using MongoDBRick Copeland
 

More from Rick Copeland (12)

Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)Python Functions (PyAtl Beginners Night)
Python Functions (PyAtl Beginners Night)
 
Schema Design at Scale
Schema Design at ScaleSchema Design at Scale
Schema Design at Scale
 
Building Your First MongoDB Application
Building Your First MongoDB ApplicationBuilding Your First MongoDB Application
Building Your First MongoDB Application
 
Chef on MongoDB and Pyramid
Chef on MongoDB and PyramidChef on MongoDB and Pyramid
Chef on MongoDB and Pyramid
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Chef on Python and MongoDB
Chef on Python and MongoDBChef on Python and MongoDB
Chef on Python and MongoDB
 
Real-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.ioReal-Time Python Web: Gevent and Socket.io
Real-Time Python Web: Gevent and Socket.io
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQRealtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
Realtime Analytics Using MongoDB, Python, Gevent, and ZeroMQ
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and Python
 
Allura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForgeAllura - an Open Source MongoDB Based Document Oriented SourceForge
Allura - an Open Source MongoDB Based Document Oriented SourceForge
 
MongoATL: How Sourceforge is Using MongoDB
MongoATL: How Sourceforge is Using MongoDBMongoATL: How Sourceforge is Using MongoDB
MongoATL: How Sourceforge is Using MongoDB
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

Rapid and Scalable Development with MongoDB, PyMongo, and Ming

  • 3. - Get started with PyMongo - Sprinkle in some Ming schemas - ODM: When a dict just won’t do
  • 4. >>>importpymongo >>>conn = pymongo.Connection() >>>conn Connection('localhost', 27017) >>>conn.test Database(Connection('localhost', 27017), u'test') >>>conn.test.foo Collection(Database(Connection('localhost', 27017), u'test'), u'foo') >>>conn['test-db'] Database(Connection('localhost', 27017), u'test-db') >>>conn['test-db']['foo-collection'] Collection(Database(Connection('localhost', 27017), u'test-db'), u'foo- collection') >>>conn.test.foo.bar.baz Collection(Database(Connection('localhost', 27017), u'test'), u'foo.bar.baz')
  • 5. >>>db = conn.test >>>id = db.foo.insert({'bar':1, 'baz':[ 1, 2, {'k':5} ] }) >>>id ObjectId('4e712e21eb033009fa000000') Auto-Generated _id >>>db.foo.find() <pymongo.cursor.Cursor object at 0x29c7d50> >>>list(db.foo.find()) Cursors are python [{u'bar': 1, u'_id': ObjectId('4e712e21eb033009fa000000'), u'baz': [1, 2, {'k': 5}]}] generators >>>db.foo.update({'_id':id}, {'$set': { 'bar':2}}) >>>db.foo.find().next() {u'bar': 2, u'_id': ObjectId('4e712e21eb033009fa000000'), u'baz': [1, 2, {'k': 5}]} >>>db.foo.remove({'_id':id}) >>>list(db.foo.find()) [] Remove uses same query language as find()
  • 6. >>>db.foo.insert([ dict(x=x) forxinrange(10) ]) [ObjectId('4e71313aeb033009fa00000b'), … ] >>>list(db.foo.find({ 'x': {'$gt': 3} })) Range Query [{u'x': 4, u'_id': ObjectId('4e71313aeb033009fa00000f')}, {u'x': 5, u'_id': ObjectId('4e71313aeb033009fa000010')}, {u'x': 6, u'_id': ObjectId('4e71313aeb033009fa000011')}, …] >>>list(db.foo.find({ 'x': {'$gt': 3} }, { '_id':0 } )) [{u'x': 4}, {u'x': 5}, {u'x': 6}, {u'x': 7}, {u'x': 8}, {u'x': 9}] >>>list(db.foo.find({ 'x': {'$gt': 3} }, { '_id':0 } ) ....skip(1).limit(2)) [{u'x': 5}, {u'x': 6}] >>>db.foo.ensure_index([ Partial Retrieval ...('x’,pymongo.ASCENDING),('y’,pymongo.DESCENDING)]) u'x_1_y_-1’ Compound Indexes
  • 7. One Rule (for now): Avoid Javascript http://www.flickr.com/photos/lizjones/295567490/
  • 8. You gotta write Javascript (for now)  It’s pretty slow (single-threaded JS engine)  MongoDB 2.2 with New  Javascript is used by Aggregation Framework  $where in a query Coming Real Soon Now ™  .group(key, condition, initial, reduce, finalize=None)  .map_reduce(map, reduce, out, finalize=None, …)  Sharding gives some parallelism with .map_reduce() (and possibly ‘$where’). Otherwise you’re single threaded.
  • 9. >>>importgridfs >>>fs = gridfs.GridFS(db) Python context >>>withfs.new_file() asfp: manager ... fp.write('The file') ... >>>fp <gridfs.grid_file.GridIn object at 0x2cae910> >>>fp._id ObjectId('4e727f64eb03300c0b000003') Retrieve file by _id >>>fs.get(fp._id).read() 'The file'  Arbitrary data can be stored in the ‘fp’ object – it’s just a Document (but please put it in ‘fp.metadata’)  Mime type, links to other docs, etc.
  • 10. >>>file_id = fs.put('Moar data!', filename='foo.txt') >>>fs.get_last_version('foo.txt').read() 'Moar data!’ Create file by filename >>>file_id = fs.put('Evenmoar data!', filename='foo.txt') >>>fs.get_last_version('foo.txt').read() 'Even moar data!’ >>>fs.get_version('foo.txt', -2).read() 'Moar data!’ >>>fs.list() “2nd from the last” [u'foo.txt'] >>>fs.delete(fs.get_last_version('foo.txt')._id) >>>fs.list() [u'foo.txt'] >>>fs.delete(fs.get_last_version('foo.txt')._id) >>>fs.list() []
  • 11. - Get started with PyMongo - Sprinkle in some Ming schemas - ODM: When a dict just won’t do
  • 12. Your data has a schema  Your database can define and enforce it  It can live in your application (as with MongoDB)  Nice to have the schema defined in one place in the code  Sometimes you need a “migration”  Changing the structure/meaning of fields  Adding indexes, particularly unique indexes  Sometimes lazy, sometimes eager  “Unit of work:” Queuing up all your updates can be handy
  • 13. Model Datastore (schema) (database) Session
  • 14. >>>importming.datastore >>>ds = ming.datastore.DataStore('mongodb://localhost:27017', database='test') >>>ds.db Connection + Database(Connection('localhost', 27017), u'test') Database >>>session = ming.Session(ds) >>>session.db Database(Connection('localhost', 27017), u'test') >>>ming.configure(**{ Optimized for config ... 'ming.main.master':'mongodb://localhost:27017', files ... 'ming.main.database':'test'}) >>>Session.by_name('main').db Database(Connection(u'localhost', 27017), u'test')
  • 16. frommingimport schema, Field WikiDoc= collection(‘wiki_page', session, Field('_id', schema.ObjectId()), Index created on Field('title', str, index=True), import Field('text', str)) CommentDoc= collection(‘comment', session, Field('_id', schema.ObjectId()), Field('page_id', schema.ObjectId(), index=True), Field('text', str)) Shorthand for schema.String
  • 17. frommingimport Document, Session, Field classWikiDoc(Document): class__mongometa__: session=Session.by_name(’main') name='wiki_page’ indexes=[ ('title') ] title = Field(str) text = Field(str)  Old declarative syntax continues to exist and be supported, but it’s not being actively improved  Sometimes nice when you want additional methods/attrs on your document class
  • 18. >>>doc = WikiDoc(dict(title='Cats', text='I can hazcheezburger?')) >>>doc.m.save() >>>WikiDoc.m.find() <ming.base.Cursor object at 0x2c2cd90> >>>WikiDoc.m.find().all() Documents are dict subclasses [{'text': u'I can hazcheezburger?', '_id': ObjectId('4e727163eb03300c0b000001'), 'title': u'Cats'}] >>>WikiDoc.m.find().one().text u'Ican hazcheezburger?’ >>>doc = WikiDoc(dict(tietul='LOL', text='Invisible bicycle')) >>>doc.m.save() Traceback(most recent call last): File "<stdin>", line 1, … Exception pinpoints ming.schema.Invalid: <class 'ming.metadata.Document<wiki_page>'>: problem Extra keys: set(['tietul'])
  • 19. >>>ming.datastore.DataStore('mim://', database='test').db mim.Database(test)  MongoDB is (generally) fast  … except when creating databases  … particularly when you preallocate  Unit tests like things to be isolated  MIM gives you isolation at the expense of speed & scaling
  • 20. - Get started with PyMongo - Sprinkle in some Ming schemas - ODM: When a dict just won’t do
  • 21. frommingimport schema, Field fromming.odmimport (mapper, Mapper, RelationProperty, ForeignIdProperty) Plain Old Python WikiDoc= collection('wiki_page',session, … ) Classes CommentDoc= collection(’comment’, session, … ) classWikiPage(object): pass Map classes to classComment(object): pass collection + session odmsession.mapper(WikiPage, WikiDoc, properties=dict( comments=RelationProperty('WikiComment'))) odmsession.mapper(Comment, CommentDoc, properties=dict( page_id=ForeignIdProperty('WikiPage'), page=RelationProperty('WikiPage'))) “Relations”
  • 22. classWikiPage(MappedClass): class__mongometa__: session = main_odm_session name='wiki_page’ indexes = [ 'title'] _id = FieldProperty(S.ObjectId) title = FieldProperty(str) text = FieldProperty(str) comments = RelationProperty(’Comment’)
  • 23. Session ODMSession  My_collection.m… My_mapped_class.query…  ODMSessionactually does stuff  Track object identity  Track object modifications  Unit of work flushing all changes at once >>>pg = WikiPage(title='MyPage', text='is here') >>>session.db.wiki_page.count() 0 >>>main_orm_session.flush() >>>session.db.wiki_page.count() 1
  • 25. Various plug points in the session  before_flush  after_flush  Some uses  Logging changes to sensitive data or for analytics  Full-text search indexing  “last modified” fields  Performance instrumentation
  • 26. Various plug points in the mapper  before_/after_:  Insert  Update  Delete  Remove  Some uses  Collection/model-specific logging (user creation, etc.)  Anything you might want a SessionExtension for but would rather do per-model
  • 28. Rick Copeland @rick446 Arborian Consulting, LLC Feedback? http://www.surveymonkey.com/s/5DLCYKN http://www.flickr.com/photos/f-oxymoron/5005673112/

Editor's Notes

  1. Who’s using mongodb? In production?Who’s using python? In production?Who’s using both together? In Production?I’m a consultant, but I *was* an engineer at SourceForgeI’ve been using MongoDB at SourceForge since 0.8, Python since 2002 or so, love them bothWe extracted our MongoDB libraries into a separate OSS project ‘Ming’ (play off of the planet Mongo from Flash Gordon)We’re going to have lots of code here. Hope you like Python!
  2. Someone is going to put weird data in your database.Or they will try.Catch them in the act.