comparaison-java-mongodb-mysql/mongoDBProject/mongoDBProject/src/main/java/lb/isae/etudiant/mongoDBProject/CRUD.java
//Create user with name , password and description
Create user with name , password and description
Create user with name password and description
public void create(String name, String pass ,String desc) {
      try {
         db.getCollection("users").insertOne(new Document()
         .append("UserName", name).append("Password", pass).append("description", desc));
      } catch (Exception ex) {
         System.out.println(ex.getMessage());
      }
   }
public void create ( String name , String pass , String desc ) { try { db . getCollection ( "users" ) . insertOne ( new Document ( ) . append ( "UserName" , name ) . append ( "Password" , pass ) . append ( "description" , desc ) ) ; } catch ( Exception ex ) { System . out . println ( ex . getMessage ( ) ) ; } }
Create user with name , password and description
Create user with name password and description