title: Update realtime database in Firebase
body: <p>I am creating a API which can update value from realtime database (Firebase). Using ClaudiaJS to create API. Basically, API will update the number of student of a class by year.</p>
  
  <p>What I have done:</p>
  
  <p>Realtime Database (Firebase)</p>
  
  <pre><code>class
   |__2015
   |    |__numberOfStudent: 50
   |__2016
        |__numberOfStudent: 60 
  </code></pre>
  
  <p>Export to JSON like this:</p>
  
  <pre><code>{
    "class": {
      "2015": {
        "numberOfStudent": 50
      },
      "2016": {
        "numberOfStudent": 60
      }
    }
  }
  </code></pre>
  
  <p>Javascript file (ClaudiaJS):</p>
  
  <pre><code>var ApiBuilder = require('claudia-api-builder');
  api = new ApiBuilder();
  module.exports = api;
  
  var admin = require("firebase-admin");
  
  var serviceAccount = require("./xxxxxxx-firebase-adminsdk-nxxxxx.json");
  
  admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "https://xxxxxx.firebaseio.com"
  });
  
  api.post('/addmore/{year}/{number}', function (request) {
      var database = admin.database().ref('class');
  
      //Params
      var year = request.pathParams.year;
      var number = request.pathParams.number;
  
      var ref = year + '/numberOfStudent'; // '2015/numberOfStudent'
  
      database.update({
          ref : parseInt(number) // "2015/numberOfStudent" : 60
      });
  
      return 'Update successfully';
  
  });
  </code></pre>
  
  <p>When I run the api in Postman: </p>
  
  <blockquote>
    <p><a href="http://xxxxapi.com/addmore/2015/55" rel="nofollow noreferrer">http://xxxxapi.com/addmore/2015/55</a></p>
  </blockquote>
  
  <p>What happened: API replied 'Update successfully', but the database didn't get any update. It seems that the code <em>database.update()</em> doesn't work at all.</p>
  
  <p>Any suggestion is very appreciated</p>