When configuring MongoDB in Spring, the reference sais: register MongoDB like this: @Configuration public class AppConfig { /* * Use the standard Mongo driver API to create a It is convenient to set an environment variable to your MongoDB installation directory (e.g. I have tried passing the setting the connection spring in the application.properties -> spring.data.mongodb.uri= I am getting the below errors: (2.3.1) with similar Spring configuration and Java Driver (4.0.4). public MongoDbFactory mongoDbFactory() throws UnknownHostException{ How to get embedded data in a MongoDB document? MongoDB Database Big Data Analytics. Following is the syntax to get the embedded data in a MongoDB document. db.yourCollectionName.find ( {}, {yourOuterKeyName.yourInnerKeyName:1}).pretty (); Let us first create a collection with documents. Business layer The controller where all the # mongodb spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 spring.data.mongodb.database=testdb If we want to configure MongoDB, we can set the corresponding properties. To allow Spring Boot to configure Spring Mongo add the following properties to your application.properties spring.data.mongodb.host= # the db host Spring Boot by default attempts to connect to a locally hosted instance of MongoDB, using the test database. Infrastructure for Spring Configure MySQL Using Spring Boot Properties. Once you have installed MongoDB, you need to start a MongoDB server. If you just want to connect your spring boot app with mongodb, you can use the keyStore and trustStore with java code. org.springframework.data.mongodb.core: MongoDB core support. In your mongoTemplate you have referred to mongoDBFactory, but you do not have id attribute specified for the factory.