html52.com
我爱小程序-开发者交流社区

数据库API,db.collection.orderBy函数的fieldPath参数不可以是汉字吗?

因为数据库里的字段名已经使用汉字了,并且试验过where用汉字做条件没问题,但orderBy不行了(注意:不是数据库里,在数据库后端是可以的,但云函数不行),如下:

db.collection(event.table).where(
      event.condition
    ).orderBy("上报时间", "desc").get()

提示的是:

VM10080:1 BI-RP-response-96-[云函数] [generalDB]  调用失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 7fb89a69-1be2-11ea-a17f-52540025df0e, cloud function service error code -504002, error message
Error
    at Function.isFieldPath (:24596/var/user/node…onjs/validate.js:33)
    at Query.orderBy (:24596/var/user/node…mmonjs/query.js:130)
    at Query.module.exports../src/api/database/api/database/query.ts.Query.orderBy (:24596/var/user/node…r-sdk/index.js:1725)
    at EventHandler.exports.main [as realHandler] (:24596/var/user/index.js:20)
    at EventHandler.handle (:24596/var/runtime/n…e8/bootstrap.js:405)
    at invoke (:24596/var/runtime/n…e8/bootstrap.js:208)
    at Timeout.setTimeout [as _onTimeout] (:24596/var/runtime/n…e8/bootstrap.js:137)
    at ontimeout (:24596/appservice/timers.js:475)
    at tryOnTimeout (:24596/appservice/timers.js:310)
    at Timer.listOnTimeout (:24596/appservice/timers.js:270); at cloud.callFunction api;
    at new u (VM10096 WAService.js:1)
    at d (VM10096 WAService.js:1)
    at f (VM10096 WAService.js:1)
    at Function.success (VM10096 WAService.js:1)
    at VM10096 WAService.js:1
    at C (VM10096 WAService.js:1)
    at i.<anonymous> (VM10096 WAService.js:1)
    at i.emit (VM10096 WAService.js:1)
    at Xi (VM10096 WAService.js:1)
    at VM10096 WAService.js:1

我知道应该尽量用英文,

我只是想知道的是fieldPath是一个什么样的对象,为什么不叫field,应该怎样构造出来,是否能够通过其他方式看到其他的fieldPath?

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付