New Banner :) TEST UPDATE Learn more

Offered By: IBM

Persisting data with MongoDB

Learn how to persist data in your microservices to MongoDB, a document-oriented NoSQL database.

Continue reading

Course

Javascript

At a Glance

Learn how to persist data in your microservices to MongoDB, a document-oriented NoSQL database.

You will learn how to use MongoDB to build and test a simple microservice that manages the members of a crew. The microservice will respond to POST, GET, PUT, and DELETE requests that manipulate the database.
The crew members will be stored in MongoDB as documents in the following JSON format:
{
  "_id": {
    "$oid": "5dee6b079503234323db2ebc"
  },
  "Name": "Member1",
  "Rank": "Captain",
  "CrewID": "000001"
}
This microservice connects to MongoDB by using Transport Layer Security (TLS) and injects a MongoDatabase instance into the service with a Contexts and Dependency Injection (CDI) producer. Additionally, MicroProfile Config is used to easily configure the MongoDB driver.
For more information about CDI and MicroProfile Config, see the guides on Injecting dependencies into microservices and Separating configuration from code in microservices.

Estimated Effort

25 Minutes

Level

Beginner

Skills You Will Learn

Jakarta EE, Java, MicroProfile, Open Liberty

Course Code

GPXX017WEN

Tell Your Friends!

Saved this page to your clipboard!

Stay Ahead in AI – Subscribe to Our Newsletter

Get latest insights, courses, and trends in AI and cognitive computing by joining our newsletter. Be the first to know about new learning opportunities, expert articles, and exclusive content.

Have questions or need support? Chat with me 😊