Django 和 Mongo ORM 映射

Django & Mongo ORM mapping

我有一个带有 MongoDB 的 Django 项目,通过 pymongo 连接。 我调查了 several ORM(-like) layers,但其中 none 似乎维护得很好或支持 Django 1.8(mongo-引擎仅支持 Django 1.5,mongokit 不再维护,而其他图书馆似乎没有背后真正的社区)。

所以我认为我将只使用 pymongo,这意味着我需要自己实现很多事情,例如验证(检查集合中插入的每个文档是否具有必填字段和字段类型)。 我该怎么做? 有没有我可以看看的示例项目?

我找到了从 Django 直接连接到 Mongo 的 this 项目,但其中没有太多结构。

使用 PyMODM。正如您链接的文档所说,"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