为了方便查找,把信息都贴在这:
Error: errCode: -502001 database request fail | errMsg: document.update:fail [FailedOperation] invalid key in $date object: offset; at document.update api;
导致问题的原因(困扰我几个月了):
const serverTime = pp.serverDate();
如果你的代码中直接使用serverDate() 对象 就会造成上面的错误:
.update({
data: {
userinfo: event.userinfo,
updateTime: serverTime
}
});
直接将该对象改成:
const serverTime = new Date().getTime();
当前sdk是什么版本呢,更新到最新的版本再试下呢
{
"name": "login",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "^2.1.2"
}
}