title: Spring data mongodb query converts String to ObjectId automatically
body: <p>The title might not be super clear, here the problem</p>
  
  <p>I'm executing an update in this form:</p>
  
  <pre><code>db.poi.update({
    _id: ObjectId("50f40cd052187a491707053b"),
    "votes.userid": {
      "$ne": "50f5460d5218fe9d1e2c7b4f"
    }
  },
  {
    $push: {
      votes: {
        "userid": "50f5460d5218fe9d1e2c7b4f", 
        "value": 1
      }
    },
    $inc: { "score":1 }
  })
  </code></pre>
  
  <p>To insert a document in an array only if there isn't one with the same userid (workaround because unique indexes don't work on arrays). The code works fine from mongo console. From my application I'm using this:</p>
  
  <pre><code>@Override
  public void vote(String id, Vote vote) {
      Query query = new Query(Criteria.where("_id").is(id).and("votes.userid").ne(vote.getUserid()));
      Update update = new Update().inc("score", vote.getValue()).push("votes", vote);
      mongoOperations.updateFirst(query, update, Poi.class);
  }
  </code></pre>
  
  <p>This works fine if as "userid" I use a String that can't be a mongo ObjectId, but if I use the string in the example, the query executed translates like this (from mongosniff):</p>
  
  <pre><code>update  flags:0 q:{ _id: ObjectId('50f40cd052187a491707053b'), votes.userid: { $ne: ObjectId('50f5460d5218fe9d1e2c7b4f') } } o:{ $inc: { score: 1 }, $push: { votes: { userid: "50f5460d5218fe9d1e2c7b4f", value: 1 } } }
  </code></pre>
  
  <p>The string is now an Objectid. Is this a bug? BasicQuery do the same thing. The only other solution I see is to use ObjectId instead of String for all classes ids.</p>
  
  <p>Any thoughts?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is the Vote class</p>
  
  <pre><code>public class Vote {
    private String userid;
    private int value;
  }
  </code></pre>
  
  <p>This is the User class</p>
  
  <pre><code>@Document
  public class User {
  
    @Id
    private String id;
    private String username;
  }
  </code></pre>
  
  <p>This is the class and mongo document where I'm doing this update</p>
  
  <pre><code>@Document
  public class MyClass {
  
    @Id
    private String id;
    @Indexed
    private String name;
    int score
    private Set&lt;Vote&gt;votes = new HashSet&lt;Vote&gt;();
  }
  </code></pre>
  
  <p>As Json</p>
  
  <pre><code>{
    "_id" : ObjectId("50f40cd052187a491707053b"),
    "name" : "Test",
    "score" : 12,
    "votes" : [
      {
        "userid" : "50f5460d5218fe9d1e2c7b4f",
        "value" : 1
      }
    ]
  }
  </code></pre>
  
  <p>Userid in votes.userid is pushed as String, but the same String is compared as an ObjectId in the $ne</p>