title: How to query documents using "_id" field in Java mongodb driver?
body: <p>I am trying to find documents in MongoDB by searching on "_id" key. My document looks like this-</p>
  
  <pre><code>{
    "_id" : ObjectId("4f693d40e4b04cde19f17205"),
    "hostname" : "hostnameGoesHere",
    "OSType" : "OSTypeGoesHere"
  }
  </code></pre>
  
  <p>I am trying to search this document as- </p>
  
  <pre><code>ObjectId id= new ObjectId("4f693d40e4b04cde19f17205");        
  BasicDBObject obj = new BasicDBObject();        
  obj.append("_id", id);        
  BasicDBObject query = new BasicDBObject();        
  query.putAll(query);
  </code></pre>
  
  <p>But I get below error- </p>
  
  <pre><code>error: reference to putAll is ambiguous, both method putAll(Map) in BasicBSONObject and method putAll(BSONObject) in BasicBSONObject match
          query.putAll(query);
  </code></pre>
  
  <p>The append method of BasicDBObject supports (String Key, Value) and if I pass "_id" as String to this method, no documents are matched. </p>
  
  <p>So my question is how do I pass "_id"? </p>