title: Datatype validation error - MeteorJS/Autoform/SimpleSchema/Embedded Simple Schema
body: <p>I am using Simple Schema,collection hooks and Autoform packages in Meteor and I am trying to update a Embedded object in my schema in the after update collection hook. I feel I might doing something silly, but was just unable to solve this problem. I am getting the exeption while saving: <code>Exception while invoking method '/providers/update' Error: 0 must be an integer</code>
  My schema:</p>
  
  <pre><code>Schemas.Providers = new SimpleSchema({
  email: {
  type: String,
  label: 'Email Address',
  autoValue: function() {
    if (this.isInsert || this.isUpdate) {
      return Meteor.user().emails[0].address;
    }
  },
  autoform: {
    afFieldInput: {
      type: 'email'
    }
   }
  },
  officelocation: {
   type: String,
   label: 'Location of Office',
   optional:true
  },
  location: {
   type: [LocationSchema],
   optional:true
  }});
  </code></pre>
  
  <p>The collection hook that works:</p>
  
  <pre><code>Providers.after.update(function (userId, doc) {
  var oldDoc = this.previous;
  Providers.direct.update({_id: doc._id},{$set: {location:{
      type:'Point',
      coordinates:[0,0]
  }}});
  });
  </code></pre>
  
  <p>The collection hook that does not work.. Ideally I should not be updating after the collection update, but wanted to make sure this works:</p>
  
  <pre><code>Providers.after.update(function (userId, doc) {
  var oldDoc = this.previous;
  var array=[];
  var iArray=doc.officelocation.split(",");
  array.push(Number(iArray[1]));
  array.push(Number(iArray[0]))
  Providers.direct.update({_id: doc._id},{$set: {location:[{
      type:'Point',
      coordinates:array
  }]}}); 
  });
  </code></pre>