title: Using MongoEngine Document class methods for custom validation and pre-save hooks
body: <p>I am currently exploring the possibilities of the MongoEngine "object document mapper". What is currently not clear to me is to what extent I can move my validation and object creation logic to the Document objects themselves.</p>
  
  <p>I have the impression that it should not be a problem, but I'm not finding a lot of examples/caveats/best practices regarding issues as</p>
  
  <ul>
  <li>Custom validation functions that are automatically called on save() to evaluate if field contents are valid;</li>
  <li>Automatic generation of the identifier on save(), based on the hash of the contents of a field;</li>
  </ul>
  
  <p>I think I need to override the save() method, so that I can call my custom logic, but the lack of examples leads me to believe that that may be a wrong approach...</p>
  
  <p>Any examples, or references to high-quality codebases using mongoEngine, are welcome.</p>