Start a new topic

compound queries not working

I am following your documentation for compound queries exactly.

(http://devcenter.kinvey.com/backbone/guides/datastore)





var userCollection = new Kinvey.Backbone.UserCollection();

var promise = userCollection.fetch({

discover : true,

query : query.equalTo('last_name', 'Wood').or().equalTo('last_name', 'Roe'),

success : function(collection, response, options) {

Ti.API.info('user check response:' + JSON.stringify(userCollection));

},

error:function(err){

Ti.API.info(err);

}

});



This throws the 'error' callback with no information.

If I change the query to

query.equalTo('last_name', 'Wood'), I get a 'success' callback with the data that I was expecting.



Please update your documentation or tell me what I'm doing wrong.

Thanks!

Great, thanks for the info : )
You are using [User Discovery](http://devcenter.kinvey.com/backbone/guides/users#lookup). Here, only the equalTo operator is supported, the `or()` operator will therefore not work.



You can either not use User Discovery, or, if you need it, run two separate queries: one with `last_name: "Wood"` and one with `last_name: "Roe"`.
Login or Signup to post a comment