How can I make 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何制作 Parse.Query.AND?
基础教程推荐
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
