title: associative array is removed in post request
body: <p>I have an mongoose schema with some properties and subproperties. On the version property I want a subproperty with the <code>Mixed</code> type, because I will send different key/value pairs to this property. But after sending the data to node, the subproperty is empty and is not saved in MongoDB.</p>
  
  <h2>This is my Schema</h2>
  
  <pre><code>var Product = new mongoose.Schema({
      name: { 
          type: String
      },
      nameSlug: { 
          type: String
      },
      uploader: {
          _id: mongoose.Schema.Types.ObjectId,
          name: {
              type: String,
              required: true
          }
      },
      uploadDate: {
          type: Date,
          default: Date.now,
          required: true
      },
      dateLastModified: {
          type: Date,
          default: Date.now,
      },
      isBestseller: {
          type: Boolean,
          default: false,
          required: true
      },
      isVerified: {
          type: Boolean,
          default: false
      },
      suggestedRetailPrice: {
          type: Number
      },  
      brand: {
          _id: mongoose.Schema.Types.ObjectId,
          name: {
              type: String,
              required: true
          },
          nameSlug: {
              type: String,
              required: true
          },
          images: [Image]
      },
      productCollection: {
          type: String
      },
      category: {
          type: String,
          required: true
      },
      versions: [{
          author: [{
              name: String,
              _id: false
          }],
          date: {
              type: Date,
              required: true
          },
          concept: {
              type: Boolean,
              required: true
          },
          modifiedProperties: [mongoose.Schema.Types.Mixed],
          history: [{
              status: String,
              author: [{
                  name: String,
                  _id: false
              }],
              date: Date
          }]
      }]
  }, {strict: false});
  
  module.exports = mongoose.model('Product', Product);
  </code></pre>
  
  <p>Image an subschema which is not relevant now. On the <code>versions</code> property I have an <code>modifiedProperties</code> property which I want to fill with the changed product (name, nameslug, etc) properties on a update in my Angular application. I create that object as follows</p>
  
  <h2>Angular code</h2>
  
  <pre><code>var modifiedProperties = [];
  
  angular.forEach($scope.addProductForm, function(value, key) {
      if(key[0] == '$') return;
      if(value.$dirty){
          modifiedProperties[key] = value.$$lastCommittedViewValue;
      }
  });
  
  var version = {
      author: {
          name: $rootScope.user.firstName + ($rootScope.user.lastNamePrefix ? " " + $rootScope.user.lastNamePrefix + " " : " ") + $rootScope.user.lastName,
          _id: $rootScope.user._id
      },
      date: new Date(),
      concept: true,
      modifiedProperties: modifiedProperties,
      history: {
          author: {
              name: $rootScope.user.firstName + ($rootScope.user.lastNamePrefix ? " " + $rootScope.user.lastNamePrefix + " " : " ") + $rootScope.user.lastName,
              _id: $rootScope.user._id
          },
          status: "Versie aangemaakt",
          date: new Date()
      }
  }
  console.log("VERSION", version);
  
  var product = $scope.product;
  product.versions.push(version);
  
  $api.update('products/' + nameSlug, product)
      .then(function(response) {
          console.log("response", response);
      })
      .catch(function(reason) {
          console.log(reason);
  })
  </code></pre>
  
  <p>In the console I see the properties correctly filled in, but after a save operation everything but <code>modifiedProperties</code> is saved.  I placed some logs in the update function, and what I see is that the <code>modifiedProperties</code> is empty in the controller. I don't know where he lose it's data. 
  The <code>$api</code> service is our wrapper for the <code>$http</code> function. The data is there not loose, and will we be send using the <code>data</code> field.</p>
  
  <h2>The controller</h2>
  
  <pre><code>module.exports.updateProduct = function(req, res) {
      console.log('[updateProduct controller]');
  
      /* This helper function can be called from elsewhere in the updateProduct controller and processes the HTTP response (and possibly errors) */
      function sendResponse(status, response, err) {
  
          /* Log HTTP response to the console server side before actually sending it to the client. */
          console.log(status + ' ' + response.message);
  
          /* Also log stack trace on error */
          if(err) {
              console.log('\nError message: ' + err);
              console.log(err.stack);
          }
  
          /* Send HTTP response */
          res.status(status).json(response);
      }
  
      if(req.params &amp;&amp; req.params.nameSlug &amp;&amp; req.body) {
          //Empty modifiedProperties (Array(0))
          console.log("REQ", req.body");
          let verifyProduct;
          if(req.body.verifyProduct &amp;&amp; req.body.verifyProduct == true) {
              verifyProduct = true;
              delete req.body.verifyProduct;
          }
          console.log("PRODUCT", req.body);
  
  
          req.body.dateLastModified = Date.now();
  
          Product.findOneAndUpdate({nameSlug:req.params.nameSlug}, req.body, function (err, product) {
  
              /* Some error occurred while trying to update the product. */
              if(err) { 
  
                  sendResponse(400, {message: 'Product could not be added. '}, err);
  
              /* The product doesn't exist */
              } else if(!product) {
  
                  sendResponse(404, {message: 'Product not found. '});
  
              /* The product exists and has been updated successfully. */
              } else {
  
                  /* Check if this product is being verified by an admin or not. If so, check if the admin is the same person who initially uploaded the product. */
                  if(verifyProduct == true &amp;&amp; product.uploader._id != req.user._id) {
  
                      /* If so, find that user to get their email adress. */
                      User.findById(product.uploader._id, function(err, user) {
  
                          /* An error occurred, so mailing the original uploader is not possible. */
                          if(err) {
  
                              sendResponse(200, {message: 'Product updated with errors. ', product}, err);
  
                          /* The original uploader does not exist (anymore), so sending mail is not possible. */
                          } else if(!user) {
  
                              sendResponse(200, {message: 'Product updated, but the uploader doesn`t seem to exist. ', product});
  
                          /* Send an email to the original uploader to notify them. */
                          } else {
  
                              var data = {
                                  product: product,
                                  user: user
                              };
  
                              var options = {
                                  to: user.email,
                                  subject: product.en.name + ' is toegevoegd aan PrismaNote!',
                                  template: 'retailer-product-verified'
                              };
  
                              mailService.mail(options, data, null);
                              sendResponse(200, {message: 'Product updated. ', product});
                          }
                      });
                  } else {
                      sendResponse(200, {message: 'Product updated. ', product});
                  }
              }
          });
      }
  };
  </code></pre>
  
  <p>Does anybody know where this can go wrong? Or why this is happen? </p>
  
  <h2>Edit:</h2>
  
  <p>I see the array <code>modifiedProperties</code> has a length of '0' because of the keys. Is that maybe the reason why nodejs won't proces it?</p>