1

I have just migrated from parse to kinvey as a result of the shutdown and i was wondering if anybody could help me figure out how this query would look like with the kinvey SDK. Here it is:

let innerP1 = NSPredicate(format: "sender = %@ AND other = %@", userName, otherName)
let innerQ1:PFQuery = PFQuery(className: "Messages", predicate: innerP1)

let innerP2 = NSPredicate(format: "sender = %@ AND other = %@", otherName, userName)
let innerQ2:PFQuery = PFQuery(className: "Messages", predicate: innerP2)

        let query = PFQuery.orQueryWithSubqueries([innerQ1,innerQ2])
        query.addAscendingOrder("createdAt")
        query.findObjectsInBackgroundWithBlock {
            (objects:[PFObject]?, error:NSError?) -> Void in  //UPDATE THIS
}
rici
  • 234,347
  • 28
  • 237
  • 341

1 Answers1

0

As a broad example...

http://devcenter.kinvey.com/phonegap/reference/api/Kinvey.Query.html

var query = new Kinvey.Query();
var query2 = new Kinvey.Query();
query.equalTo("sender",userName).and().equalTo("other",other name);
query2.equalTo("sender",otherName).and().equalTo("other",userName);
query.or(query2);
query.ascending("_kml.lmt"); //last modified time

var promise = Kinvey. DataStore.Find("group name",query);
promise.then(successfunction,fail function);

Also please note this is an example with the phonegap library, please see the kinvey reference for Android or iOS for your situation.

Aidan
  • 757
  • 3
  • 13