Follow Join

Stay away from django-nonrel :-| Oct 16, 2012

If you're thinking to use https://github.com/django-nonrel to work with MongoDB, well, please don't, atleast for a while :-|

why, do you ask ?

I went for it. MongoDB. Non Relational Databases. Awesome ! It really is awesome, except that its query evaluation is BROKEN.

in django ORM, it works pretty well with Model.objects.filter(), but it works exactly opposite if you use Model.objects.exclude() !

In my use case I needed to create quite a few Q objects and AND/OR them according to some conditions. I was AND'ing.

I thought of a dirty hack. I can invert my logic and get the thing done for now. that means OR'ing and reverting signs. So it will fail according to other platforms but I can just get done with this thing. Guess what, Multiple OR's are still not supported :-| There is a ticket for this on github. #140 I think.

So I can't get the thing done by any means, except, scrap django-nonrel :-|

Code rewrite. Why ? because I used List and Dict field provided by djangotoolbox, Need to change them in relationships and change code accordingly :-|

I did some quick checks to find this out. Made exactly similar app [ Contacts ] in django 1.3 and django-nonrel 1.3. dumped same data and fired same queries. Here's a screenshot of results. On Left its sqlite3, on right its MongoDB. May not make sense because you don't know the whole set of data but compare the output of exclude() according to Q object given above. If you know django, you should get whats wrong.

Screenshot