In this tutorial, we show you how to use Java MongoDB API collection.update() to update documents. Test Data Assume following data / documents are inserted. { "hosting" : "hostA", "type" : "vps", "clients" : 1000 }, { "hosting" : "hostB", "type" : "dedicated server", "clients" : 100 }, { "hosting" : "hostC", "type" : "vps", "clients" : 900 } { "_id" : { "$oid" : "id"} , "hosting" : "hostA" , "type