title: Meteor - insert array of objects
body: <p>I have this Schema (using meteor-collection2):</p>
  
  <pre><code>Settings = new Mongo.Collection("settings");
  
  var Schema = {};
  
  Schema.Settings = new SimpleSchema({
  
  user_id: {
          type: String,
          optional: false
      },
      settings_firm_name: {
          type: String,
          optional: false
      },
      settings_firm_primary_branch: {
          type: String,
          optional: false
      },
      settings_firm_employees_num: {
          type: Number,
          optional: false,
          min:1
      },
      settings_firm_address: {
          type: String,
          optional: false,
      },
      settings_firm_email: {
          type: String,
          regEx: SimpleSchema.RegEx.Email,
          optional: false,
      },
      settings_firm_web_page: {
          type: String,
          optional: false,
      },
      settings_firm_contact_phone: {
          type: String,
          optional: false,
      },
      settings_firm_fax: {
          type: String,
          optional: false,
      },
      settings_firm_social: {
          type: [Object],
          optional: false,
      },
  
      "firm_social.$.name": {
          type: String
      },
      "firm_social.$.link": {
          type: String,
          regEx:SimpleSchema.RegEx.Url
      }
  });
  </code></pre>
  
  <p>I want to add to my database data that is validated by this schema. settings_firm_social is array of object. That objects are created from three different input fields where each object have name and link fields. How can I insert that document in my database? I simply try with:</p>
  
  <pre><code>Settings.insert(settings, function(error,result){
   if(error){console.log(error)}
  
  });
  </code></pre>
  
  <p>But my array then is populated with three empty objects ({}).</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>When I log settings object that I pass to Meteor method befor insert:</p>
  
  <pre><code>I20150627-00:29:36.523(2)? Server log
  I20150627-00:29:36.543(2)? { settings_firm_name: 'Test',
  I20150627-00:29:36.543(2)?   settings_firm_primary_branch: 'test',
  I20150627-00:29:36.543(2)?   settings_firm_employees_num: '200',
  I20150627-00:29:36.543(2)?   settings_firm_address: 'Test',
  I20150627-00:29:36.544(2)?   settings_firm_contact_phone: '12345',
  I20150627-00:29:36.544(2)?   settings_firm_fax: '123445',
  I20150627-00:29:36.544(2)?   settings_firm_web_page: 'http://localhost:3000/settings/ZQwjxYzBuSfodxHvF',
  I20150627-00:29:36.544(2)?   settings_firm_email: 'test@hotmail.com',
  I20150627-00:29:36.544(2)?   settings_firm_social:
  I20150627-00:29:36.545(2)?    [ { name: 'Facebook',
  I20150627-00:29:36.545(2)?        link: 'http://localhost:3000/settings/ZQwjxYzBuSfodxHvF' },
  I20150627-00:29:36.545(2)?      { name: 'Twitter',
  I20150627-00:29:36.546(2)?        link: 'http://localhost:3000/settings/ZQwjxYzBuSfodxHvF' },
  I20150627-00:29:36.546(2)?      { name: 'LinkedIn',
  I20150627-00:29:36.546(2)?        link: 'http://localhost:3000/settings/ZQwjxYzBuSfodxHvF' } ],
  I20150627-00:29:36.546(2)?   user_id: 'ZQwjxYzBuSfodxHvF' }
  </code></pre>
  
  <p>After insert:</p>
  
  <pre><code>I20150627-00:31:23.185(2)? { settings_firm_name: 'Test',
  I20150627-00:31:23.185(2)?   settings_firm_primary_branch: 'test',
  I20150627-00:31:23.185(2)?   settings_firm_employees_num: 200,
  I20150627-00:31:23.185(2)?   settings_firm_address: 'Test',
  I20150627-00:31:23.185(2)?   settings_firm_contact_phone: '12345',
  I20150627-00:31:23.186(2)?   settings_firm_fax: '123445',
  I20150627-00:31:23.186(2)?   settings_firm_web_page: 'http://localhost:3000/settings/ZQwjxYzBuSfodxHvF',
  I20150627-00:31:23.187(2)?   settings_firm_email: 'test@hotmail.com',
  I20150627-00:31:23.187(2)?   settings_firm_social: [ {}, {}, {} ],
  I20150627-00:31:23.187(2)?   user_id: 'ZQwjxYzBuSfodxHvF' }
  </code></pre>