If I have a document like this
{'id': 123, 'keywords': {'keyword1': 3, 'keyword2': 8, 'keyword3': 2}}
Can I get a query result with keywords sorted by values, like
{'id': 123, 'keywords': {'keyword3': 2, 'keyword1': 3, 'keyword2': 8}}
Is there a built-in mongodb feature for doing this? Or I have to implement this in application level?