title: Mongoose $inc operation error on a nested document
body: <p>I have the following schema:</p>
  
  <pre><code>const postsStatsSchema = new Schema({
      postid: {
          type: String,
          maxlength: [128, "post ID must be at most 128"],
          required: true
      },
      likecounter: {
          type: Number,
          default: 0,
          min: 0,
          required: true
      }
  });
  
  const userStatsSchema = new Schema({
      username: {
          type: String,
          required: true,
          maxlength: [50, "Name length must be at most 50"]
      },
      posts: {
          type: [postsStatsSchema],
          required: true
      }
  });
  
  const statisticsSchema = new Schema({
      month: {
          type: Number,
          required: true
      },
      users: {
          type: [userStatsSchema],
          required: true
      }
  }, {
      timestamps: true
  });
  </code></pre>
  
  <p>I'm trying to increment (or create, if the document does not exist) the 'likecounter' in the postsStats object. I tried many different ways, but non were successful. This is the last thing I tried:</p>
  
  <pre><code>let update = {};
  update['$inc'] = {};
  update['$inc'] = {'users.$.username.user.$.posts.somepost.likecounter': 1000};
  
  try {
      const res = await stats.findOneAndUpdate({month: 100}, update, {'upsert': true});
      console.log(res);
  } catch (err) {
      console.log(err);
  }
  </code></pre>
  
  <p>The error I'm getting on the code above is:</p>
  
  <pre><code> MongoError: Too many positional (i.e. '$') elements found in path
  </code></pre>
  
  <p>I tried many variations, with and without the '$' sign, but only managed to increment the month. I believe it is something with the nested document that Im doing wrong but just can't figure out what it is.</p>