title: How to update MongoDb database in Java?
body: <p>I'm newbie with the MongoDb, there are a lot of examples about updating a collection in 2.x versions but I couldn't find any source about 3.x versions.</p>
  
  <p>JAVA CODE:</p>
  
  <pre><code>    MongoClient mongoClient = new MongoClient("localhost",27017);
      MongoDatabase database = mongoClient.getDatabase("dbTest");
      MongoCollection&lt;Document&gt; collection =    database.getCollection("colTest");
      Document updateQuery = new Document();
      updateQuery.append("$set",
      new Document().append("_id", "test"));
      Document searchQuery = new Document();
      searchQuery.append("likes", "125");
      collection.updateMulti(searchQuery, updateQuery); //.updateMulti gives an error.
  </code></pre>
  
  <p>There isn't any updateMulti in 3.x so how can I check the id of the database and change one of the datas?</p>
  
  <p>Example MongoDB: </p>
  
  <pre><code> { 
  "_id" : "test",
     "status" : 2,
     "time" : null,
     "instagram" :{
           "description" : "database",
           "likes" : 100,
           "url" : "http://www.instagram.com/",
           "by", "users"
     },
     "batchid" : 15000234
  }
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>{ 
     "_id" : "test",
     "status" : 1,
     "time" : null,
     "instagram" :{
           "description" : "database",
           "likes" : 125,
           "url" : "http://www.instagram.com/",
           "by", "users"
     },
     "batchid" : 15000234
  }
  </code></pre>