0

So i want to change the value of a specific field called "likes"

Here is the schema:

//...
fields: [
          {
            name: "likes",
            title: "Likes",
            type: "number",
          }
]

I want to change the like count when a button is pressed. it should change the like count by +1.

How to change the value?

Dev-Siri
  • 592
  • 5
  • 22

1 Answers1

2

You can use client.patch(doc).inc({likes: 1}).commit() to increment your likes field each time it's called.

Geoff Ball
  • 743
  • 3
  • 14