How Python MongoDB Toolkit Ming Can Ease Schema Maintenance
And now that you're all caught up, let's jump right in with Ming....
Why Ming?
If you've come to MongoDB from the world of relational databases, you have probably been struck by just how easy everything is: no big object/relational mapper needed, no new query language to learn (well, maybe a little, but we'll gloss over that for now), everything is just Python dictionaries, and it's so, so fast!
While this is all true to some extent, one of the big things you give up with MongoDB is structure.
MongoDB is sometimes referred to as a schema-free database. (This is not technically true; I find it more useful to think of MongoDB as having dynamically typed documents. The collection doesn't tell you anything about the type of documents it contains, but each individual document can be inspected.)
While this can be nice, as it's easy to evolve your schema quickly in development, it's easy to get yourself in trouble the first time your application tries to query by a field that only exists in some of your documents.
The fact of the matter is that even if the database cares nothing about your schema, your applicationdoes, and if you play too fast and lose with document structure, it will come back to haunt you in the end. The main reason Ming was created at SourceForge was to deal with just this problem. We wanted a (thin) layer on top of pymongo that would do a couple of things for us:
1. Make sure that we don't put malformed data into the database
2. Try to 'fix' malformed data coming back from the database
So, without belaboring the point of its existence, let's jump into Ming.
Why Ming?
If you've come to MongoDB from the world of relational databases, you have probably been struck by just how easy everything is: no big object/relational mapper needed, no new query language to learn (well, maybe a little, but we'll gloss over that for now), everything is just Python dictionaries, and it's so, so fast!
While this is all true to some extent, one of the big things you give up with MongoDB is structure.
MongoDB is sometimes referred to as a schema-free database. (This is not technically true; I find it more useful to think of MongoDB as having dynamically typed documents. The collection doesn't tell you anything about the type of documents it contains, but each individual document can be inspected.)
While this can be nice, as it's easy to evolve your schema quickly in development, it's easy to get yourself in trouble the first time your application tries to query by a field that only exists in some of your documents.
The fact of the matter is that even if the database cares nothing about your schema, your applicationdoes, and if you play too fast and lose with document structure, it will come back to haunt you in the end. The main reason Ming was created at SourceForge was to deal with just this problem. We wanted a (thin) layer on top of pymongo that would do a couple of things for us:
1. Make sure that we don't put malformed data into the database
2. Try to 'fix' malformed data coming back from the database
So, without belaboring the point of its existence, let's jump into Ming.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-732624/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- How MySQL Can Finally Kick Some MongoDBMySqlMongoDB
- SQL can execute in wrong SchemaSQL
- Can one rename a database user (schema)?Database
- How can I add a site title refiner
- JavaScript’s “this”: how it works, where it can trip you upJavaScript
- How can I get the followling results?
- How can I work smarter, not just harder? Ask it forever
- Global Contrast based Salient Region Detection (Ming ming Cheng)AST
- How to Cim load multiple entries into 7.6.5.4 SO Container Maintenance or 16.11AINaN
- MongoDB報錯:"assertion" : "can't map file memory"MongoDB
- DB2 PL/SQL How much reorganisations are recommended on a specific schemaDB2SQL
- How can I prevent users from connecting to a USB storage device?dev
- How Can We Maintain Decanter Centrifuge for Mud Solids Control?AISolid
- How to Clean Up Duplicate Objects Owned by SYS and SYSTEM Schema_1030426.6Object
- Unity Dotween Ease曲線 圖表 效果展示Unity
- How Python list works?Python
- 完美解決stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.ErrorPython
- How many nodes can be had in an HP-UX/Solaris/AIX/Windows/Linux cluster?AIWindowsLinux
- How to install Python module?Python
- 2.3.3 Application MaintenanceAPPAINaN
- ALLOCATE CHANNEL FOR MAINTENANCE 命令AINaN
- Give root password for maintenanceAINaN
- Maintenance of Global Partitioned IndexesAINaNIndex
- SQL Database Maintenance WizardSQLDatabaseAINaN
- How to draw a simple relation graph in PythonPython
- 奇特的 Ming dark with golden flavor GTK 主題Go
- 2.3.3.1 About Application MaintenanceAPPAINaN
- 11g auto maintenanceAINaN
- Cannot find folder "Maintenance Plans".AINaN
- Three commands for OCR maintenanceAINaN
- How to Convert Decimal Numbers to Words with PythonDecimalPython
- 生成樹Toolkit
- Toolkit安裝
- three predefined automated maintenance tasksAINaN
- 上海:International Release and Maintenance EngineerAINaN
- Recovery Catalog creation and MaintenanceAINaN
- Day 3(Python + Git + MongoDb)PythonGitMongoDB
- Python演算法-How to sort a dictionary by valuePython演算法