In this recipe, we will look at executing the query and
insert operations using the Java client for MongoDB. Unlike the Python programming language, Java code snippets cannot be executed from an interactive interpreter, and thus we will be having some unit test cases already implemented, whose relevant code snippets will be shown and explained.
For this recipe, we will start a standalone instance. Refer to the Installing single node MongoDB recipe from Chapter 1, Installing and Starting the Server for instructions on how to start the server.
The next step is to download the Java project,
mongo-cookbook-javadriver, from the Packt website. This recipe uses a JUnit test case to ...