我怎样才能让Parse.Query.AND? [英] How can I make Parse.Query.AND?
问题描述
我需要在Parse.com 2查询与并连接,我的code是:
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
是所有的对象用户= Parse.User.current())
和所有与德谢厄=艺术家
的对象,但我想这两个查询的对象组合在一起:
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:
用户= Parse.User.current())
和德谢厄=艺术家
推荐答案
您实际上已经得到它设置正确,做一个和查询。问题(假设你的数据结构是正确安装)是你的用户的字段是一个指向用户表。因此,你需要查询等于指针的用户,而不是用户等于 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!