Skip to content
#

relay

Here are 800 public repositories matching this topic...

zmras
zmras commented May 15, 2020

Hi! Let's assume I have the following data:

obj = {
  _id: 'someId',
  items: [
    { value: 'a', count: 5 },
    { value: 'b', count: 1 },
  ]
}

Please, I want to know how can I use obj.increment() to increment the count field of the first element in items?

I have tried obj.increment('items.0.count') but it doesn't work. I got the following error: Cannot read property '0'

Improve this page

Add a description, image, and links to the relay topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the relay topic, visit your repo's landing page and select "manage topics."

Learn more

You can’t perform that action at this time.