py-couchdb
py-couchdb copied to clipboard
feature request: get sorted by key
like the pull request histrio/py-couchdb#55 (use OrderedDict) it would also be nice to have an option to get docs sorted by key.
Stackoverflow recursivly sort by key:
def sortOD(od):
res = OrderedDict()
for k, v in sorted(od.items()):
if isinstance(v, dict):
res[k] = sortOD(v)
else:
res[k] = v
return res