最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

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

IT培训 admin 8浏览 0评论

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

我使用Node.js和back4app

我尝试更新用户对象。因此,我读了很多书,发现了这个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,我尝试更新用户对象。因此,我已经阅读了很多书,并找到了这份很有用的文档:let progressId =“ xyz”;让userId =“ 12354”; // aka objectId ...

回答如下:

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

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

我使用Node.js和back4app

我尝试更新用户对象。因此,我读了很多书,发现了这个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,我尝试更新用户对象。因此,我已经阅读了很多书,并找到了这份很有用的文档:let progressId =“ xyz”;让userId =“ 12354”; // aka objectId ...

回答如下:

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

发布评论

评论列表 (0)

  1. 暂无评论