comparaison-java-mongodb-mysql/mongoDBProject/mongoDBProject/src/main/java/lb/isae/etudiant/mongoDBProject/CRUD.java
//update the role of user by name 
update the role of user by name
update the role of user by name
public void updateRole(String name, List<String> role) {
      try {
         db.getCollection("users")
         .updateOne(new Document("UserName", name),
         new Document("$set", new Document("category", role)));
      } catch (Exception ex) {
         System.out.println(ex.getMessage());
      }
   }
public void updateRole ( String name , List < String > role ) { try { db . getCollection ( "users" ) . updateOne ( new Document ( "UserName" , name ) , new Document ( "$set" , new Document ( "category" , role ) ) ) ; } catch ( Exception ex ) { System . out . println ( ex . getMessage ( ) ) ; } }
update the role of user by name
update the role of user by name