db.command.set 中包含 db.Geo.Point 时会报签名错误
发布于 5 年前 作者 futao 9331 次浏览 来自 官方Issues

const cloud = require('wx-server-sdk')
 
cloud.init({ env: '环境ID' });
const db = cloud.database();
const _ = db.command;
 
exports.main = async () => {
  await db.collection('todos').add({
    data: {
      _id: 'xxx',
      description: 'eat an apple',
      test: { location: db.Geo.Point(113, 23), other0: 0 }
    }
  });
 
  await db.collection('todos').doc('xxx').update({
    data: {
      test: _.set({ location: db.Geo.Point(113, 23), other1: 1, other2: 2 })
    }
  })
}

复现步骤:

  1. 在云环境中创建一个  todos 集合

  2. 新建一个云函数,替换为上面的代码,修改云环境 env id

  3. 右键点击云函数,打开 「本地调试」

  4. 勾选「本地调试」,点击 「调用」

  5. 即可出现

抛出 Error:

errCode: -501001 resource system error | errMsg: signature calculated is different from client signature; 

1 回复

您好,我这边试了一下是成功的,没有出现这个报错,考虑你这边出错是缓存问题或者数据问题,可以清理缓存试一下哈~

如果还有问题,麻烦提供一下环境id和个人账号信息~

回到顶部