wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

Infinite resource depth #87

Open yjaaidi opened 9 years ago

yjaaidi commented 9 years ago

Hi,

For our app wishtack.com, we need to support infinite depth resources like "/blogs/.../posts/.../comments/..." and there are probably many people out there who need this.

In order to solve this, we had to implement a bunch of Resource mixins.

Are you planning something concerning this? Otherwise, we can work on integrating this in django-tastypie-mongoengine and make a pull request.

Thanks!

danstovall commented 9 years ago

I didn't have any plans for that personally. Currently, I plan on adding querying abilities for those nested resources (/blogs/.../posts/.../coments/?date__lt=2014-08-11) and keeping it current with the latest versions of mongoengine, tastypie and django. Past that, I don't have much of a roadmap for it. I was just added as an admin for the project and it currently meets most of use cases I have for it. It is fine with me if you want make a pull request and start adding those capabilities. I definitely don't want to see this project go stale, but my needs for it right now are pretty much all met.

Other admins on the project may have other opinions.

mitar commented 9 years ago

I have not get request for this before, so I am not sure how asked is this. I think the main reason is that it is not really normal to have too nested MongoDB documents. Often you then split your database structure into multiple documents/collections and you do request from client against multiple REST endpoints.

If you instead of highly nested documents you have in mind references and resolving them on-the-fly, then I would also caution against this. As it currently stands, it would probably happen that for each reference you would make one MongoDB query to the database. So if you would open a list of 100 documents, which have each one reference to a document, you would be making 101 queries to MongoDB to get this through REST.

So in both cases it is a question how good it is that you have such schema.

But yes, pull requests are welcome. :-)