Django-nonrel vs Django-mongodb vs Mongokit vs pymongo native

本小妞迷上赌 提交于 2019-11-27 21:50:57

问题


Working on a Django project that requires a NoSQL store and I believe I've settled on Mongo. I've seen a lot of topics that talk about Mongo and Django, but none that mentioned Django-nonrel, and I can't see why it might have been disqualified, but I have no experience with any of them.

Ideally, I'd like to preserve the SQL store for the simple things, user auth, groups, etc., and use Mongo for the bigger data.

I'd also like to have my Mongo-stored objects as classes, in a Django-ORM style, so that I can have a similar 'feel', but that isn't critical.

Lastly, do any of the above allow me to use Django's multi-database support for anything, or are all my mongo queries effectively 'out of band' from the Django ORM?

If there are any other factors I'm missing that might be important, feel free to clue me in. I know little in this arena.


回答1:


Django-nonrel is the way to go for Django on MongoDB. There's django-mongodb.org, but that's just built on top of Django-nonrel. There's quite a bit of mongodb activity going on the django-nonrel mailing list.

Storing your mongo classes as Django ORM objects works fine, that's the whole point.

I haven't tried using the multi-database support along with SQL. I haven't seen many people use it like that, and I suspect it most likely does not work. There's some work on moving django-nonrel to be officially part of Django 1.4, I suspect it'll work after that's complete.

Using django-nonrel for auth works ok. The main problem is many-to-many relations. The auth module uses that for per user object permissions - that doesn't work. If you don't need that, you could probably get away without using the SQL at all.




回答2:


Adding onto dragonx answer. The issue with django-nonrel is that the auth module doesn't work.

You can perform many-to-mamy joins using $lookup operator. djongo does automatically for you. It translates SQL syntax into mongodb aggregation queries and populates the object model, like other SQL drivers.

The auth module works fine on djongo



来源:https://stackoverflow.com/questions/10424562/django-nonrel-vs-django-mongodb-vs-mongokit-vs-pymongo-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!