我怎样才能让Parse.Query.AND? [英] How can I make Parse.Query.AND?

查看:151
本文介绍了我怎样才能让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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆