Question about incrementing data value, from a specific collection in mongodb with nodejs

So iI followed a tutorial which has taught me some things about nodejs and mongodb. I now know how to insert new data from the server in to my database.

But what I can’t seem to figure out is how to update existing data in a collection. I have searched on a lot of places but sadly no clear answer for me. I am a little of a noob still with this so excuse me if i say things that are probably wrong.

So this is what I’ve tried to set up:

Code from my Controller.js:

      app.get("/button", function(req, res) {
  mongo.connect(url_monitor, function (err, db) {
      assert.equal(null, err);
      db.numbers.update({ $inc: { number: -2}})



I am using the MVC model that has the: controller, model and view. So all pages in the view folder are .ejs files. II am also using Query and ajax to send a request to the controller.


$('#btn1').on('click', function(){
    var number =  {number: 0}
      type: 'GET',
      url: '/button',
      data: number,
      success: function(number){
        //do something with the data via front-end framework
        alert('It works')


<!DOCTYPE html>
<html lang="en">
    <script src="/assets/button.js"></script>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Todo List</title>
  <link href="/assets/styles.css" rel="stylesheet" type="text/css">
    <h1>Button test</h1>
<button id="btn1">Increase number</button>

So basically what I am trying to achieve is that once I press a button somewhere on a page, it would increase/decrease a value in the database in one of the specific collections. I am kinda lost with this, any help would be appreciated