收藏
回答

云函数 在数据库聚合阶段使用match函数,做日期处理就会报错?

db.collection('xunlian')
          .aggregate()
          .match({
            qiantao_id: 'xxx', 
            time: _.gt(new Date("2020-02-08 00:00:00")).and(_.lt(new Date("2020-02-08 23:59:59")))
          }).end()

总是报错:"[InvalidParameter] Check request parameter fail. Please check your request, but if the problem cannot be solved, contact us.; "

为了测试什么问题,

1:我把 time过滤条件注释掉, 结果:程序正常

2: time: _.gt(new Date("2020-02-08 00:00:00")) 这样写也有同样报错,看来和 and 没有关系

3:我把time拿到小程序端执行 结果也正常 (说明这个time过滤语法没有问题)

    productCollection.where({
      createTime: _.gt(new Date(strtime)).and(_.lt(new Date(endtime)))
    }).get({
      success: function(res) {
        console.log(res.data)
      }
    })
//这个是直接操作的数据库,没有做数据库的聚合操作

但是他们2个在一起就报错了....

我也不知道是我的问题还是官方这里有bug 不知道是不是数据库聚合阶段 才有这个问题,

反馈出来,看看官方能否帮忙看看



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

2 个回答

登录 后发表内容
问题标签