Help needed to understand Mutating data on DB

Hey Everyone, I hope I am posting this in the right place. I have been building out my own personal project to learn RedwoodJS. I have followed along with the tutorial with great success.

One part is not clear to me, I have created a post model with a likeCount field. The DB is up and running no problems there. What is the correct procedure to create a component that will mutate just the likeCount data on the post model.

hey @Lanc3! welcome to the community :slight_smile:

if you want a mutation for only that field, what you’ll need to do is as follows:

on the api side:

  1. define the mutation type to accept whatever parameters are needed to update that field, ie the post id and field value
  2. create the corresponding mutation resolver in the model’s service

on the web side:

  1. create a form that uses this mutation

reread chapter 3 for more detailed examples and information: Saving Data | RedwoodJS Docs

Thank you @arimendelow
Glad to be a part of the community, I have fallen in love with the redwood way.

I did as you said and got to the end result i was looking for. Looking forward to showing off the results soon.

Thanks again

2 Likes

same here, redwood and this community are both unmatched :slight_smile:

excited to see what you build with it!

1 Like