title: Azure Node.js Table Entity Update
body: <p>I'm trying to update a table entity during data insertion using server Node script. Here is what I'm trying to do. I have a Address table which has a column named geolocation of type "geography". When a user updates the Address, I'm using npm-geocoder to get the latitude and longitude to update the geolocation column. </p>
  
  <p>Here is the code snippet. </p>
  
  <pre><code>var table = module.exports = require('azure-mobile-apps').table();
  
  table.dynamicSchema = true;
  
  table.insert(function (context) {
  
      var address = context.item.lines1 + ' ' + context.item.lines2 + ' ' + context.item.city + ' ' + context.item.state + ' ' + context.item.zip;
      var geocoderProvider = 'google';
      var httpAdapter = 'https';
      var extra = {
          apiKey: '',
          formatter: null
      };
  
      var geocoder = require('node-geocoder')(geocoderProvider, httpAdapter, extra);
      geocoder.geocode(address)
      .then(function(res) {
          var geolocation = "POINT("+ res[0].longitude + "  " + res[0].latitude +")";
          console.log("Value of Geolocation is ", geolocation);
          context.item.geolocation = geolocation;
      })
      .catch(function(err) {
          console.log("Error ", err);
      });
  
      return context.execute();
  });
  </code></pre>
  
  <p>However, i don't see the table being updated with the geolocation. Any pointers?</p>
  
  <p>I looked at few samples available online but they are mostly based on previous mobile services where the insert method signature is different for ex:- </p>
  
  <pre><code>function insert(item, user, request) { 
      var queryString = "INSERT INTO Place (title, description, location) VALUES (?, ?, geography::STPointFromText('POINT(' + ? + ' '
  + ? + ')', 4326))";         
      mssql.query(queryString, [item.title, item.description, item.longitude.toString(), item.latitude.toString()], { 
                  success: function() { 
                       request.respond(statusCodes.OK, {}); 
                  } 
            });
  }
  </code></pre>