title: ObjectId in mongoDB 2.6 not working
body: <p>I'm using spring data mongodb in my application. It uses mongodb 2.6. I want to query documents of a collection by the id which mongo assigns during insertion. I'm doing something like this:</p>
  
  <pre><code>Query query = new Query();
  String id = "542385a91f00bf7dbeae1fc7";
  query.addCriteria(Criteria.where("_id").new Object(id));
  template.find(query, entity.class);
  </code></pre>
  
  <p>This query translates to:</p>
  
  <pre><code>{ "_id" : { "$oid" : "542385a91f00bf7dbeae1fc7"}}
  </code></pre>
  
  <p>When I execute the same on mongo shell, it gives an error:</p>
  
  <blockquote>
    <p>error: {
        "$err" : "Can't canonicalize query: BadValue unknown operator: $oid",
        "code" : 17287
    }</p>
  </blockquote>
  
  <p>How do I query by id using spring data mongodb?</p>