The Wayback Machine - https://web.archive.org/web/20201010190115/https://github.com/topics/nodejs
Skip to content
#

Node.js

nodejs logo

Node.js is a tool for executing JavaScript in a variety of environments. JavaScript had humble beginnings as a language that lived only in web browsers, but the Node.js project has expanded its reach and helped make it the most popular programming language in the world. Node.js extends the creative potential of people with web development experience, enabling a new generation of developers to create servers, command-line tools, desktop apps, and even robots.

Here are 99,931 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'

Created by Ryan Dahl

Released May 27, 2009

Organization
nodejs
Website
nodejs.org/en
Wikipedia
Wikipedia
You can’t perform that action at this time.