在Javascript中从解析中获取用户 [英] Get user from parse in Javascript
问题描述
我知道这个问题可能会被问多次,但我无法完全获取 User 对象.问题是用户对象仅返回用户名、电子邮件和电话号码属性,而我向用户对象添加了某些字段,例如名字和姓氏.
I know this question may be asked multiple times but I am not able to get the User object in its entirity. The problem is that the user object returns only the username, email and the phone number properties while I have certain fields added like first name and last name to the user object.
我想知道是否有办法完全获取用户对象
I'd like to know if there's a way to get the user object in its entirity
解析云上的对象应该看起来像
The object on parse cloud should look like
User:
{
"firstname": "firstname",
"lastname": "lastname",
"username": "username",
"email": "abc.xyz@jkl.pqr",
"phone": "0123456789",
"type": "admin/super-admin/user"
}
我使用以下查询来获取对象
I use following query to get the object
var query = new Parse.Query(Parse.User);
query.equalTo("username", "username"); // Whatever be the username passed by search string
query.find({
success: function (user) {
console.log("Success:", user)
},
error: function (error) {
//Show if no user was found to match
}
});
我得到的用户对象如下:
I get the user object as follows:
user:{
createdAt:"2014-12-27T07:16:09.826Z"
email: "abc.xyz@pqr.mno"
objectId: "223tch5S6J"
phone: "0123456789"
updatedAt: "2014-12-27T07:16:09.826Z"
username: "username"
}
我没有得到其他属性,如类型、名字、姓氏.
I do not get the other properties like type, firstname, lastname.
注意:我不需要获取 parse 无论如何都没有提供的密码,所以这不是问题.
推荐答案
user.attributes
应该保存服务器端保存的所有用户属性
user.attributes
should hold all the user attributes saved server side
这篇关于在Javascript中从解析中获取用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!