Parse.com - cloud code - what should I do with the pointer?

Someone does not understand what I want. I want to know what I can do with a pointer.

I have js cloud code.

I have a pointer.

What can I do with it?

Example:

var query = new Parse.Query("Messages"); //POINTER QUERY
console.log(userMessages[0].get("messageId"));
console.log("end2");
query.equalTo("objectId",userMessages[position].get("messageId"));

In this example, userMessages is the result of a previous cloud request.

This line

console.log(userMessages[0].get("messageId"));

useful output

{"__type":"Pointer","className":"Messages","objectId":"5J4eOletgz"}

This is less useful than you might imagine. I can not name the objectId from it, but the request

query.equalTo("objectId",userMessages[position].get("messageId"));
query.find ({ ... });

returns nothing. Please note that the request must be found pointer-object pointer-point-but, but instead it helps to reset the error

Error: 102 bad special key: __type

It is just useless.

What can I do with a pointer? Why don't people at parse.com want to write this stuff anywhere?

This second question is more like a Buddhist koan so that they meditate, no need to answer!

+4
3

:

userMessagesQuery.include("messageId")

, userMessages, "messageId" .

userMessages[0].get("messageId").fetch({success:function(){}})

, "include"

: "messageId" "", , , .

+6

- Parse , . ( ), fetch().

objectId , , Parse, myPointer.objectId.

, :

// I would suggest renaming messageId if you're actually storing pointers
var messagePointer = userMessages[position].get("messageId");
query.equalTo("objectId", messagePointer.objectId);

, @RipRyness, include() , .

userMessagesQuery.include("messageId");

// ... later in success handler ...

// now a fully populated Message object
var message = userMessages[position].get("messageId");
console.log(message);
+3

, , .

, UserMessages, .include( "messageId" ) - , .

include userMessages[0].get("messageId") Message, userMessage. , .

+2

Source: https://habr.com/ru/post/1542368/


All Articles