Update Mutations



Using an Update mutation you can perform Updates on any of the tables exposed in the API.
 
--- LINKS ---
 
Free Community Edition Download
 
Alpha Software YouTube Channel
 
Documentation
 
 

 
#deletions #mutations #api #mobileapp #app #ui #android #ux #ios #mobileappdevelopment #appdesign #uidesign #mobileapps #appdevelopment

Transcript

in a previous video we showed how you

can use the get customer query to return

data for a particular customer in your

database so you can see here we're

returning data for the customer bollard

and we can see that the this particular

customer is based in Madrid so let's now

go and update the City field by using a

mutation so we're going to go and we can

see that if we go to our Doc's and we go

to mutations we can see that there is an

update for customers there's an update

queries defined over here called update

customers and there we go update

customer over there and you can see that

the syntax is it takes a where clause

and a set clause inside curly parens so

we'll go here we'll get rid of this and

we'll type in mutation curly bracket and

then the name of the mutation is update

customer will go there and we'll open

our curly parens and now we're going to

go here and define our where clause

which is going to basically be customer

ID is valid and then how set clause is

going to be city is equal to say so Val

and then after we define our where

clause and our set clause we can go here

and define the shape of the result

that's going to be returned by this

query so I'll say after we do this I'd

like to see the customer ID and I'd like

to see the contact name and the city and

also the country so let's go ahead now

and execute this so we can see now that

the city has been changed to serve oh

this is the shape of the result that we

wanted

back so we got out our shape back over

there and we can go there and hit

prettify to reformat it so let's go back

now and change it back into civil back

to Madrid sorry

and we'll so let's go here and add in

some additional information that we'd

like to return so we'll go here and type

in say orders and then we'll type in say

order ID and then execute this so there

we get our result back we've changed the

city back to Madrid and we return some

additional information after the query

completes so we've shown here how you

can use the update customer mutation to

update records in your sequel database

and of course if your where clause

referenced more than one record then it

would update all of those records so in

this case we said customer ID of Ballard

but if we had said country equals Spain

then we would have been updating all of

the records where the country was equal

to Spain