title: How to allow free-form JSON data within Mongoose documents?
body: <p>I'm using <a href="http://mongoosejs.com/docs/model-definition.html" rel="nofollow">Mongoose ODM</a> to partially validate models before they are stored to MongoDB.</p>
  
  <p>Is it possible to relax Mongoose schemata so that a given part of the document is not validated? I have tried to the following:</p>
  
  <pre><code>var MySchema = new Schema({
      user_id: { type: Schema.ObjectId, ref: 'User' },
      freeform_data: {},
  });
  </code></pre>
  
  <p>For instance if I set the contents to:</p>
  
  <pre><code>{
     user_id: '123456',
     freeform_data: {
        dataitem1: 'a',
        dataitem2: 'b',
        items: [ 1, 2, 3, 4 ]
     }
  }
  </code></pre>
  
  <p>Then only <code>user_id</code> is stored, which makes perfectly sense security-wise.</p>
  
  <p>How can I disable mongoose's validation for this field?</p>
  
  <p>I am using this application only for prototyping purposes so I don't care about security right now (I just want to prototype).</p>