gitaarik/monkful — pull request #2 by gitaarik (2014-02-25 20:54:32+00:00)
Title: Support for subdocuments

You can now acces the subdocuments of a resource through the URL. For example, if you have a resource with an serializer like this:

class CommentSerializer(Serializer):
id = fields.ObjectIdField(identifier=True, default=ObjectId)
name = fields.StringField()
comment = fields.StringField()

class Article(Serializer):
title = fields.StringField()
comments = fields.ListField(EmbeddedDocumentField(CommentSerializer))

Then you could have these URLs:

The list of articles:
http://www.example.com/api/articles/

Article with id 530c9a8eaa264921674d7165:
http://www.example.com/api/articles/530c9a8eaa264921674d7165/

The comments of article with id 530c9a8eaa264921674d7165:
http://www.example.com/api/articles/530c9a8eaa264921674d7165/comments/

The comment with id 635d9a8aea264921674d7523 in the article with id 530c9a8eaa264921674d7165:
http://www.example.com/api/articles/530c9a8eaa264921674d7165/comments/635d9a8aea264921674d7523/

Etc.