title: Stubbing virtual attributes of Mongoose model
body: <p>Is there a way to stub a virtual attribute of a Mongoose Model?</p>
  
  <p>Assume <code>Problem</code> is a model class, and <code>difficulty</code> is a virtual attribute. <code>delete Problem.prototype.difficulty</code> returns false, and the attribute is still there, so I can't replace it with any value I want.</p>
  
  <p>I also tried</p>
  
  <pre><code>var p = new Problem();
  delete p.difficulty;
  p.difficulty = Problem.INT_EASY;
  </code></pre>
  
  <p>It didn't work.</p>
  
  <p>Assigning undefined to <code>Problem.prototype.difficulty</code> or using <code>sinon.stub(Problem.prototype, 'difficulty').returns(Problem.INT_EASY);
  </code> would throw an exception "TypeError: Cannot read property 'scope' of undefined", while doing</p>
  
  <pre><code>  var p = new Problem();
    sinon.stub(p, 'difficulty').returns(Problem.INT_EASY);
  </code></pre>
  
  <p>would throw an error "TypeError: Attempted to wrap string property difficulty as function".</p>
  
  <p>I am running out of ideas. Help me out! Thanks!</p>