Right now, the Kinvey documentation does not show how to run 'Compound Queries with Joining Operators' in the REST API docs or the Business Logic docs. There is however an example in the HTML API docs.
Because the Kinvey BaaS uses MongoDB, I went to the MongoDB docs for a stab at the solution. Lo and behold, there it is. Since there are some cases where the Kinvey syntax doesn't coincide perfectly with MongoDB, I did a bit of testing. Fortunately, this all works.
So, if you are using the Kinvey Business Logic and the 'collectionAccess' module, here is an example of using the 'OR' boolean operator in a query.
var userCollection = modules.collectionAccess.collection('user');
var query = {
$or: [
{ "email" : "some email address here" },
{ "mobile" : "some mobile number here" }
]
};
userCollection.find( query, function( queryError, queryResults ) {
if( queryError ) {
// Deal with error here.
return;
} else {
// Deal with your logic here.
}
});
- Signup to find out when Kids In Touch launches