Update Specific Record - Where Clause - Objective C


Totally new at backendless and the way that I learn is a build a simple little CRUD to see how things tie together. So far so good. However, I’m a little stuck on the best approach for updating one item within an object.

I’m seeing two different ways to update, however, unless I’m missing something both ways would update the entire datastore. Correct? Where would I specify a where clause? What I would like to do is just update a specific record. I have two functions I believe doing the same thing just differently. If you could point me in the right direction that would be excellent. Remember I’m new.

I’m using Aircraft as an example below;

-(void)updateAircraft:(Aircraft *)aircraft


Responder *responder = [Responder responder:self



aircraft.AircraftRego = @"VH-OLB?";

aircraft.AircraftType = @"Cessna";

id<IDataStore> dataStore = [backendless.persistenceService of:[Aircraft class]];

[dataStore save:aircraft responder:responder];


#pragma mark - responder



NSLog(@"%@", response);

return response;


-(id)errorHandler:(Fault *)fault


NSLog(@"%@", fault.detail);

return fault;



[backendless.persistenceService first:[Aircraft class]

response:^(Aircraft *result) {

result.NextServiceAirframe = [backendless randomString:MIN(25,500)];

result.AircraftRego = [backendless randomString:MIN(25,500)];

result.AircraftActive = [backendless randomString:MIN(25,500)];

result.AircraftType = [backendless randomString:MIN(25,500)];

result.NextServiceEngine = [backendless randomString:MIN(25,500)];

[backendless.persistenceService save:result response:^(Aircraft *result)


        } error:^(Fault *fault)




        } error:^(Fault *fault)





In parse I did something like this (where selectedRego is a variable being passed in dynamically);
PFQuery *query = [PFQuery queryWithClassName:@“Aircraft”];
[query whereKey:@“AircraftRego” equalTo:selectedRego];

        [query getFirstObjectInBackgroundWithBlock:^(PFObject *aircraftObject, NSError *error) {



Hi Jeremy,

I’ll response as I read your post. Let’s start with the first question:

I'm seeing two different ways to update, however, unless I'm missing something both ways would update the entire datastore. Correct? 

No, this is not correct. There is only one way to update an object (calling the save method) and it will update just the object and any related objects you save. The term “data store” is a abstract reference to the table which contains the data object.

Where would I specify a where clause? 

You specify it in the BackendlessDataQuery class, just like the documentation describes it:

Now onto your code. I made a few annotations. All it takes is just read through the sample code, I think it is self-explanatory, just see what it does…

What you though was “approach 1”:

And now what you thought was “Approach 2”, which in reality is the same thing as “Approach 1”:

Hope this helps.


Hi Mark,

Right…I knew there was a way I simply wasn’t seeing it/didn’t quite understand it. So getting the first allows me to update later if required. Got it. This then wouldn’t update everything just the one record. Btw i’m really liking how quick the service is. Nice. Now to fight with dates.

Thanks man!