Start a new topic

Joining Operators are not working

Hey Kinvey. We're currently having an issue using the JoiningOperators.

http://devcenter.kinvey.com/angular/guides/datastore#JoiningOperators



When we run the code, it does not return anything. The setup we have is that all information in our app is applicable to a 'group'. E.g. Milk, butter and bread all belong to the "shopping list" group (as an example). On the dashboard, a user has to select a group in order to see info within it... yet no groups are showing up at all...



Here's the code:



var query = new $kinvey.Query();

query.equalTo('_id', '5438bcf1c372846422050269’).or().equalTo('_id', '543cc642c3728464220547b6');

$kinvey.DataStore.find('groups', query).then(function (data) {

console.log(data);

}, function (error) {

console.log(error.description);

});



This code does not return any result, because I am using JoiningOperators which is: .or()

I need it to make groups work, if this code works, it should return 2 elements in array but instead it’s returning nothing.



Please let us know if you need any more information.... thanks!

Sorry to hear you are having some trouble! Would you mind posting the actual URL that is being requested? You can find in the Network panel of Chrome Devtools, for instance.



This will help us understand if the query is being constructed properly.
Hello Dave,

Thank you for your response.



This is Request URL we have: https://baas.kinvey.com/appdata/kid_VV5lz8HcD9/groups/?kinveyfile_tls=true&query=%7B%22%24or%22%3A%5B%7B%22%24or%22%3A%5B%7B%22%24or%22%3A%5B%7B%22owner_key%22%3A%22rkbqwrnxaklfabe%22%2C%22_id%22%3A%225438bcf1c372846422050269%22%7D%2C%7B%22_id%22%3A%22543cc642c3728464220547b6%22%7D%5D%7D%2C%7B%22_id%22%3A%225438bcf8784e13cb2c00430c%22%7D%5D%7D%2C%7B%22_id%22%3A%22544e9c5f058a82633e00252d%22%7D%5D%7D&_=w4e846gmxnha1yvi
Query we are doing is:

var query = new $kinvey.Query();

query.equalTo('_id', '5438bcf1c372846422050269').or().equalTo('_id', '543cc642c3728464220547b6');

$kinvey.DataStore.find('groups', query).then(function (data) {

//var 'data' here is empty, where it should return 2 items in array.

});
@Dave‌ any update on this? This is so urgent to us right now... if you have time could you please get back to us? Thanks!
Sorry for the delayed response here!



First up, an alternative way to perform this query would be using the contains operator:



`query.contains('_id', [ '', '', ... ])`



Secondly, I can't seem reproduce the query you pasted with the code you used. Are you sure that URL you pasted is the same one being requested by the query? I'll keep looking in the meantime.
Login or Signup to post a comment