I want to increase a field inside an object object inside a mongodb document by 1.

  var stuffID = 5
  collection.update({
    "id": id,
  },
  {
    '$inc': {
      'stuff.stuffID': 1
    }
  },
  function(err, doc) {
    res.end('done');
  });

I need to make that stuffID a variable. Any way to do that? Thanks.

This is using node-mongodb-native if that helps.

If you're voting to close can you explain what it is you don't understand?

Edit
Report