-
Type: New Feature
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
I tried returning data as custom class, but ran into problem where
nested dictionary would all be type of custom class I assigned.
It would be nice to have an option to only have as_class declared class to
be used for base level and not recursively.
Currently I modified code of bson._init_.py
def _elements_to_dict(data, as_class, tz_aware): result = as_class() while data: (key, value, data) = _element_to_dict(data, as_class, tz_aware) result[key] = value return result to def _elements_to_dict(data, as_class, tz_aware): result = as_class() while data: (key, value, data) = _element_to_dict(data, dict, tz_aware) result[key] = value return result
It's working pretty well this way, but it would be nice to have some way to
switch it.