我试图检索所需用户的角色,我知道是否为objectId。
exports.User.getUserRole = function(userId, success, error)
{
Parse.Cloud.useMasterKey();
console.log("getUserRole method");
var query = new Parse.Query(Parse.User);
query.
equalTo("objectId", userId)
.find({
success: function(user){
console.log("SUCCESS 1");
console.log(user);
var queryRole = new Parse.Query(Parse.Role);
queryRole
.equalTo("users", user)
.find({success: function(roles){
console.log("SUCCESS 2");
success(roles);
},
error: function(_errorRole){
console.log("FAIL 2");
console.log(_errorRole);
error(_errorRole);
}
});
},
error: function(_error){
console.log("FAIL 1");
error(_error);
}
});
但我在CloudCode日志中发现了这个奇怪的错误:
失败2 //我的console.log
{"代码":102,"消息":"平等需要一个值而不是 [map [__ type:Pointer className:_User objectId:qjsmwxQ4KQ]]"}