title: MongoDB/Morphia size query operator malfunction?
body: <p>i'm using MondoDB with Morphia 0.105 layer.</p>
  
  <p>My <code>User</code> class is:</p>
  
  <pre><code>@Entity
  public class User {
  
  @Id
  private ObjectId id = null;
  
  private String userId = null;
  private String fullName = null;
  @Embedded
  private UserType userType = null;
  @Embedded
  private Set&lt;Rights&gt; rights = new HashSet&lt;Rights&gt;();
  </code></pre>
  
  <p>and my test class is:</p>
  
  <pre><code>public class Test {
  
      public static void main(String[] args) throws UnknownHostException {
          Morphia m = new Morphia();
          Datastore ds = m.createDatastore(new MongoClient("localhost"), "test");
          m.map(User.class);
  
  
          User u = new User();
          u.setFullName("User Name");
          u.setUserId("USERID");
          //u.getRights().add(Rights.ADMIN); //NO rights added VS ONE right added
  
          ds.save(u);
          u = ds.find(User.class).filter("rights size", 0).get();
          System.out.println(u);
          System.out.println(u != null);
      }
  
  }
  </code></pre>
  
  <p>I got this unexpected result:</p>
  
  <pre><code>The type(s) for the query/update may be inconsistent; using an instance of type 'java.lang.Integer' for the field 'org.vts.sis2.entities.User.rights' which is declared as 'java.util.Set'
  </code></pre>
  
  <p>If i uncomment line <code>//u.getRights().add(Rights.ADMIN);</code> that adds to user a right, the query <code>ds.find(User.class).filter("rights size", 1).get()</code> returns the correct result (even if the warning is displayed, but it's a false positive since in my opinion it's correct to compare a result of size operator to an integer)!</p>
  
  <p>What should i do to query users with empty <code>rights</code> list/set field?</p>
  
  <p>Thanks</p>