-
Notifications
You must be signed in to change notification settings - Fork 132
Document.simplify() method #31
Comments
DotedDict is an instance of dict. This shouldn't hurt. Do you have a usecase for this feature ? |
When using a recursive function to turn the Document into a different type of output (in my case, XML), working with simple python data-types is much easier. Thought of a quick work-around:
Not sure whether this will be faster than converting to python directly; I believe mongokit converts to simple python data-types before converting to json, so in this case I'm converting mongokit->python->json->python. |
|
It's not just dicts causing problems; the |
ok I see. If I'd understood well, you'd like a |
Sort-of. I need to convert a document (mongokit.Document), all it's nested documents, and all pymongo (ObjectId) and mongokit objects (mongokit.helpers.DotedDict for example) into a nested dict of basic python types. |
Ok, it could be added without complicated the API. If you want, you can send a patch, I'll add it. |
It would be useful if there was a
.simplify()
method on Document objects, which would recursively convert the object to the base data-types as defined in the document'sstructure
, eg:The text was updated successfully, but these errors were encountered: