O'Reilly logo

MongoDB Cookbook by Amol Nayak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing query and insert operations using a Java client

In this recipe, we will look at executing the query and insert operations using a Java client for MongoDB. Unlike the Python programming language, Java code snippets cannot be executed from an interactive interpreter. Thus, we will have some unit test cases already implemented; their relevant code snippets will be shown and explained.

Getting ready

For this recipe, we will start a standalone instance. Refer to the Single node installation of MongoDB recipe in Chapter 1, Installing and Starting the MongoDB Server, to learn how to start the server.

The next step is to download the mongo-cookbook-javadriver Java project from the book's website. This recipe uses a JUnit test case to test various ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required