odmantic icon indicating copy to clipboard operation
odmantic copied to clipboard

怎么排序

Open f754699 opened this issue 1 year ago • 0 comments

Bug

我想根据前端传递的字符串进行排序,结果文档里只能使用模型的字段进行排序。 我想用Model[key]的方式获取字段,结果报错:"type 'DictType' is not subscriptable"

orderObject.order = “createTime” sort=DictType[orderObject.order] "type 'DictType' is not subscriptable"

Current Behavior

... Steps to reproduce the bug ...

Expected behavior

... A clear and concise description of what you expected to happen. ...

Environment

  • ODMantic version: ...
  • MongoDB version: ...
  • Pydantic infos (output of python -c "import pydantic.utils; print(pydantic.utils.version_info())):
...
  • Version of additional modules (if relevant):
    • ...

Additional context

Add any other context about the problem here.

f754699 avatar Sep 01 '23 07:09 f754699