简体   繁体   中英

Django & Mongo ORM mapping

I have a Django project with a MongoDB, connecting through pymongo. I've looked into several ORM(-like) layers , but none of them seem well maintained or supporting the Django 1.8 (mongo-engine only supports Django 1.5, mongokit is no longer maintained, and the other libraries seem to have no real community behind them).

So I think I'll be just using pymongo, which means that there is quite some things I'll need to implement myself, for example validation (checking that every document inserted in a collection has the required fields and field types). How would I go about this? Are there any example projects that I can take a look at?

I found this project which connects from Django directly to Mongo, but there is not much structure in it.

Use PyMODM. As the docs you linked to say, "PyMODM is an ORM-like framework on top of PyMongo. PyMODM is maintained by engineers at MongoDB, Inc. and is quick to adopt new MongoDB features. PyMODM is a “core” ODM, meaning that it provides simple, extensible functionality that can be leveraged by other libraries to target platforms like Django. At the same time, PyMODM is powerful enough to be used for developing applications on its own. Complete documentation is available on readthedocs in addition to a Gitter channel for discussing the project."

https://api.mongodb.com/python/3.4.0/tools.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM