title: How to add items to Mongo array using Jongo?
body: <p>I'm using Jongo to query mongodb. The problem is that when I try to add items to an array field I get the error that says</p>
  
  <blockquote>
    <p>HTTP Status 500 - Request processing failed; nested exception is
    java.lang.IllegalArgumentException: {$addToSet:{bodyParameters:[ {
    "first" : { "weight" : 1.0 , "height" : 2.0 , "waist" : 3.0 , "biceps"
    : 4.0 , "chest" : 5.0 , "forearm" : 6.0 , "wrist" : 7.0 , "neck" : 8.0
    , "hip" : 9.0 , "buttocks" : 10.0 , "shin" : 11.0} , "second" :
    "20130609"}]} cannot be parsed</p>
  </blockquote>
  
  <p>My method looks that way</p>
  
  <pre><code>public void updateBodyParameters(Profile profile) {
          getCollection().update("{_id:#}", profile.getUsername()).with(
                  "{$addToSet:{bodyParameters:#}", profile.getBodyParameters()
          );
      }
  </code></pre>
  
  <p>Body parameters is a class containing this</p>
  
  <pre><code>public class Tuple&lt;E, T&gt; implements Serializable {
  private E first;
  private T second;
  </code></pre>
  
  <p>And it is created as </p>
  
  <pre><code>ArrayList&lt;Tuple&lt;BodyParameters, String&gt;&gt;
  </code></pre>
  
  <p>and the BodyParameters class contains fields</p>
  
  <pre><code>private double weight;
  private double height;
  private double waist;
  private double biceps;
  private double chest;
  private double forearm;
  private double wrist;
  private double neck;
  private double hip;
  private double buttocks;
  private double shin;
  </code></pre>
  
  <p>Tell me please what's the problem with update</p>