如何制作 Parse.Query.AND?

How can I make Parse.Query.AND?(如何制作 Parse.Query.AND?)
本文介绍了如何制作 Parse.Query.AND?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我需要用 and 连接 Parse.com 中的 2 个查询,我的代码是:

I need to connect 2 queries in Parse.com with an and, my code is:

    var queryDeseo1 = new Parse.Query(DeseosModel);
    queryDeseo1.equalTo("User", Parse.User.current());
    queryDeseo1.equalTo("Deseo", artist);

    queryDeseo1.find({...

.find 的结果是所有具有 User = Parse.User.current()) 的对象和所有具有 Deseo = Artist<的对象/code> 但我希望将两个查询的对象放在一起:

The result of the .find is all the objects with User = Parse.User.current()) and all the objects with Deseo = artist but I want the objects with the two queries together:

User = Parse.User.current())Deseo = 艺术家

推荐答案

您实际上已经正确设置了它以执行 AND 查询.问题(假设您的数据结构设置正确)是您的 User 字段是指向 User 表的指针.因此,您需要查询一个等于指针的用户,而不是一个等于 Parse.User.current() 的用户,后者将返回一个字符串.类似于以下内容:

You've actually got it setup correctly to do an AND query. The problem (assuming that your data structure is setup properly) is that your User field is a Pointer to the User table. Therefore, you need to query for a User equal to the pointer, as opposed to a User equal to Parse.User.current() which will return a string. Something like the following:

var userPointer = {
  __type:    'Pointer',
  className: 'User',
  objectId:  Parse.User.current().id
}

queryDeseo1.equalTo('User', userPointer);

这篇关于如何制作 Parse.Query.AND?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How do I can get a text of all the cells of the table using testcafe(如何使用 testcafe 获取表格中所有单元格的文本)
node_modules is not recognized as an internal or external command(node_modules 未被识别为内部或外部命令)
How can I create conditional test cases using Protractor?(如何使用 Protractor 创建条件测试用例?)
PhantomJS and clicking a form button(PhantomJS 并单击表单按钮)
Clicking #39;OK#39; on alert or confirm dialog through jquery/javascript?(在警报上单击“确定或通过 jquery/javascript 确认对话框?)
QunitJS-Tests don#39;t start: PhantomJS timed out, possibly due to a missing QUnit start() call(QunitJS-Tests 不启动:PhantomJS 超时,可能是由于缺少 QUnit start() 调用)