title: Is it possible to update a subdocument via Mongoose using an $inc?
body: <p>I have a document that looks like:</p>
  
  <pre><code>{
      "personName": "Some name",
      "metaDetails": {
          "visits": 1,
          "otherMeta": 32
      }
  }
  </code></pre>
  
  <p>Using <code>Mongoose</code> for <code>Node.js</code>. I'd like to update (or insert) the visits count. Here's what I have so far. I've read about the <a href="http://www.mongodb.org/display/DOCS/Updating#Updating-The%24positionaloperator" rel="nofollow">$ positional operator</a> but I might be way off:</p>
  
  <pre><code>updObj = {}
  newKeyString = "metaDetails.$.visits"
  updObj[newKeyString] = 1
  
  
  Person.update {personName: "Some name}, {$inc: updObj}, {upsert: true}, (err, updRes) -&gt;
  </code></pre>
  
  <p>This doesn't appear to actually update or insert any documents however. Any help?</p>
  
  <p><strong>EDIT: Added the model</strong></p>
  
  <pre><code>mongoose = require 'mongoose'
  
  PersonSchema = new mongoose.Schema
    personName:
      type: String, index: true, unique: true
    metaDetails: []
  </code></pre>
  
  <p>This is my model. <code>metaDetails</code> is intentionally not defined beyond just an array because the data within can be highly variable</p>