title: Easy way to increment Mongoose document versions for any update queries?
body: <p>I want to start taking advantage of Mongooses document versioning (__v key). I was having an issue actually incrementing the version value, then I found that you have to add <code>this.increment()</code> when executing a query.</p>
  
  <p>Is there a way to have automatically incremented? For now, I just added it to the <strong>pre</strong> middleware for a update-type queries:</p>
  
  <pre class="lang-js prettyprint-override"><code>module.exports = Mongoose =&gt; {
      const Schema = Mongoose.Schema
  
      const modelSchema = new Schema( {
          name: Schema.Types.String,
          description: Schema.Types.String
      } )
  
      // Any middleware that needs to be fired off for any/all update-type queries
      _.forEach( [ 'save', 'update', 'findOneAndUpdate' ], query =&gt; {
          // Increment the Mongoose (__v)ersion for any updates
          modelSchema.pre( query, function( next ) {
              this.increment()
              next()
          } )
      } )
  }
  </code></pre>
  
  <p>Which seems to work.. But I kinda thought there would already be a way to do this within Mongoose.. am I wrong?</p>