Connecting to a single node using a Java client
This recipe is about setting up the Java client for MongoDB. You will repeatedly refer to this recipe while working on others, so read it very carefully.
Getting ready
The following are the prerequisites for this recipe:
- Java SDK 1.6 or above is recommended.
- Use the latest version of Maven available. Version 3.3.3 was the latest at the time of writing this book.
- MongoDB Java driver version 3.0.1 was the latest at the time of writing this book.
- Connectivity to the Internet to access the online maven repository or a local repository. Alternatively, you may choose an appropriate local repository accessible to you from your computer.
- The Mongo server is up and running on localhost and port
27017
. Take a look ...
Get MongoDB Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.