Skip to main content


1 comment

  • Otavio Santana

    Java is one of the most popular programming languages in the MongoDB Community. For new users, it’s essential to provide an overview of how to work with the MongoDB Java driver at

    Java has several frameworks and combinations to work with MongoDB, but it’s important to provide an overview of how to work with the MongoDB Java driver and how to use MongoDB as a Java developer. Therefore, the documentation provides tight integration between Java and MongoDB.

    This integration became easier thanks to the Java Config Reader.

    MongoDB database = config.getCredential("mongodb", MongoDB::new);
    MongoClient mongoClient = database.get();
    final MongoDatabase mongoDatabase = mongoClient.getDatabase(database.getDatabase());
    MongoCollection<Document> collection = mongoDatabase.getCollection("scientist");
    Document doc = new Document("name", "Ada Lovelace").append("city", "London");
    Document myDoc = collection.find(eq("_id", doc.get("_id"))).first();

    However, we have the option to overwrite the configurations only when it is running at such as Spring Boot MongoDB and Jakarta EE NoSQL.


    More Java combinations

    We have several articles and source code on this repository:

    This repository has several Java combinations it includes Spring, Jakarta EE, MicroProfile, MongoDB, JPA, and so on.


Please sign in to leave a comment.