收藏
回答

服务端http查询db, 使用orderBy报错

框架类型 问题类型 终端类型 AppID 基础库版本
小程序 Bug 工具 wx2fe4f1063695fe03 1

通过接口查询数据:

POST https://api.weixin.qq.com/tcb/databasequery?access_token=ACCESS_TOKEN


请求:

Array
(
    [query] => db.collection('user').where({coin: db.command.gt(150)}).field({_id: true,coin: true,point: true,nickName: true,}).orderBy('coin','desc').orderBy('point','asc').skip(0).limit(10).get()
)


返回:

Array
(
    [errcode] => 0
    [errmsg] => Query sort entered in the request is illegal. Please check your request, but if the problem persists, contact us. hint: [kFMC401202028]
)


移除orderBy之后可以正常返回查询数据,orderBy的字段也在集合中

回答关注问题邀请回答
收藏

3 个回答

  • 禾店科技
    禾店科技
    2021-04-28

    学到了

    2021-04-28
    有用 1
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2019-06-12

    你好,问题已解决,麻烦重试下

    2019-06-12
    有用
    回复 1
    • 觉醒
      觉醒
      2019-06-12

      可以了,非常感谢

      2019-06-12
      回复
  • 雄
    2019-05-22

    mark下,坐等解答

    2019-05-22
    有用
    回复 8
    • 张吉(jimmyjzhang)
      张吉(jimmyjzhang)
      2019-05-24

      最近一次请求在什么时候呢,这边没看到调用日志。

      orderBy的使用上是没问题的

      2019-05-24
      回复
    • 雄
      2019-05-28回复张吉(jimmyjzhang)

      我 刚刚 5.28 10:52又调用了一次,同样的错误。

      array(2) {
        ["errcode"] => int(0)
        ["errmsg"] => string(136) "Query sort entered in the request is illegal. Please check your request, but if the problem persists, contact us. hint: [lwnbea08602028]"
      }

      不过我是按照时间排序的,是date的数据类型,会不会跟这个有关系?楼主的那个该不会也是geopoint吧。

      2019-05-28
      回复
    • 雄
      2019-05-28回复

      再试了下,用其他字段排序也不行,跟数据类型应该没关系。

      2019-05-28
      回复
    • 张吉(jimmyjzhang)
      张吉(jimmyjzhang)
      2019-05-28回复

      你的小程序appid给一下

      2019-05-28
      回复
    • 雄
      2019-05-28回复张吉(jimmyjzhang)

      wxaf6979b1852585a3

      2019-05-28
      回复
    查看更多(3)
登录 后发表内容