// See if we're updating one document or the whole collection.
if (name == null) {
result = service.update(commands.toString());
}
else {
result = service.updateResource(name, commands.toString());
}
System.out.println(result + " documents updated");