Java tutorial
package dao.ds; import com.mongodb.DB; import com.mongodb.MongoClient; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author luigi */ public class AccesoDB { public DB getConnection() { MongoClient mongo = new MongoClient("localhost", 27017); DB mibasededatos = mongo.getDB("rrhh");// La base de datos se llama //Recursos Humanos (RRHH) return mibasededatos; // Para ver en MongoDB: // > use rrhh // > show collections } }