[英]And Query on Parse Cloud code
this looks a very trivial query but I can't seem to make it work.. I am trying to get for instance an object that has locationName = "NYC" AND groupName = "Adults". 这看起来是一个非常琐碎的查询,但是我似乎无法使它正常工作。例如,我试图获取一个具有locationName =“ NYC” AND groupName =“ Adults”的对象。 I am trying to query using this code I found on Parse documentation:
我正在尝试使用在解析文档中找到的以下代码进行查询:
var groupQuery = new Parse.Query("MyTable");
groupQuery.equalTo("group", groupName);
var locationQuery = new Parse.Query("MyTable");
locationQuery.equalTo("location", locationName);
var mainQuery = Parse.Query.or(locationQuery, groupQuery);
But I obviously fail because I am using Parse.Query.or instead what should have been Parse.Query.and which, for some reason doesn't exist... Is there any alternative way to do it, for some reason I cannot find it on the documentation.. Cheers 但是我显然失败了,因为我使用的是Parse.Query。或应该是Parse.Query。的东西,由于某种原因不存在。有其他替代方法可以执行,因为某种原因我找不到它在文档上。
Parse queries use and by default, which is why there is only a Parse.Query.or(). 解析查询默认使用和,这就是为什么只有Parse.Query.or()的原因。 What you want to do can simply be achieved this way :
您想要做的事情可以通过以下方式简单地实现:
var mainQuery = new Parse.Query("MyTable");
mainQuery.equalTo("group", groupName);
mainQuery.equalTo("location", locationName);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.