[英]Parse Cloud Code: “Cannot call method '_toPointer' of null” when calling .query() on a relation
This is something that I struggled with, and couldn't find a quick answer for. 这是我努力的事情,无法找到快速答案。 Ultimately, I realized that I wasn't reviewing the Parse documentation properly.
最终,我意识到我没有正确地审查Parse文档。
Problem 问题
If you're reading this question, perhaps you're getting the following error in your Cloud Code error log 如果您正在阅读此问题,可能是您的Cloud Code错误日志中出现以下错误
Result: TypeError: Cannot call method '_toPointer' of null
when you try to call the .query()
method of a Parse.Relation
. 当您尝试调用
Parse.Relation
的.query()
方法时。
Solution 解
Consider that you may be retrieving the relation incorrectly, in the first place. 考虑到您可能首先错误地检索关系。 I spent quite a while struggling to understand why, if I called the
.get('RELATION_KEY')
method of a Parse.Object
, I kept getting this error. 我花了很
Parse.Object
努力理解为什么,如果我调用Parse.Object
的.get('RELATION_KEY')
方法,我不断得到这个错误。
I should have been calling .relation('RELATION_KEY')
instead. 我应该一直在调用
.relation('RELATION_KEY')
。 I know this
is
was in the Parse.Object documentation, but I saw "get" and stopped reading. 我知道这
是
在Parse.Object文档中,但我看到“得到”并停止阅读。 My mistake. 我的错。
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.