title: Loopback Model Remove attribute or Property before save
body: <p>I have been trying to wrap around my head with this for some time now. </p>
  
  <p>I want to remove a certain attribute or property of a model before saving.</p>
  
  <p>So far I am trying to catch the instance using Loopback's operational hook <a href="https://loopback.io/doc/en/lb3/Operation-hooks.html#before-save" rel="nofollow noreferrer">before save</a>.</p>
  
  <pre><code>   MyModel.observe('before save', function(ctx, next){
  
        if (ctx.instance) {
           ctx.instance.removeProperty = undefined; 
        } else {
           ctx.data.removeProperty = undefined;    
        }
  
        next();
  
     });
  </code></pre>
  
  <p>Not sure why the above code is not working, by setting the attribute as <code>undefined</code> but you can set any other value to other properties.</p>
  
  <p>UPDATE: The code above was actually working. But I have the problem with the instances which already has that attribute I want to remove.</p>