Title: Java & MongoDB - Connecting Database
Open Graph Title: Java & MongoDB - Connecting Database
Description: To connect database, you need to specify the database name, if the database doesn't exist then MongoDB creates it automatically. Following is the code snippet to connect to the database − Now, let's compile and run the above program as shown below.
Open Graph Description: To connect database, you need to specify the database name, if the database doesn't exist then MongoDB creates it automatically. Following is the code snippet to connect to the database − Now, let's compile and run the above program as shown below.
Opengraph URL: https://www.tutorialspoint.com/java_mongodb/java_mongodb_connect_database.htm
Domain: www.tutorialspoint.com
| None | IE=edge |
| og:type | article |
| og:image | https://www.tutorialspoint.com/images/tp_logo_436.png |
Links:
Viewport: viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes