如何在back4app中更新用户对象?

问题描述 投票:0回答:1

我使用Node.js和back4app.com

我尝试更新用户对象。因此,我读了很多书,发现了这个promissing documentation

let progressId = "xyz";
let userId = "12354"; //aka objectId
const User = new Parse.User();
const query = new Parse.Query(User);


// Finds the user by its ID
query.get(userId).then((user) => {
    // Updates the data we want
    user.set('progressId', progressId);
   // Saves the user with the updated data
   user.save()
       .then((response) => {
           console.log('Updated user', response);
       })
       .catch((error) => {
           console.error('Error while updating user', error);
       });
   });

但是也有警告。它指出:

Parse.User类在默认情况下是安全的,除非使用经过身份验证的方法(例如savelogInsignUp]获得Parse.User,否则您将无法调用current方法>

在代码中看起来如何?

我使用Node.js和back4app.com,我尝试更新用户对象。因此,我已经阅读了很多书,并找到了这份很有用的文档:let progressId =“ xyz”;让userId =“ 12354”; // aka objectId ...

node.js parse-platform back4app
1个回答
0
投票

是的,他们的API参考非常有帮助!在此部分中,有一个“尝试JSFiddle”按钮,您已经看到了吗?

© www.soinside.com 2019 - 2024. All rights reserved.