Firstly, assign the MongboDB Service to your account on SAP Cloud platform according to my article: How to add a new Service in SAP Cloud Foundry environment

Then download the sample program provided by SAP from this link.

1. Use the cf marketplace command line to check the current SAP cloud platform MongoDB version number: on my SAP cloud platform, it is V3.0-dev

Create a service instance using the following command line:

Cf create-service mongodb v3.0-dev mongo-service

2. Go to the root directory of the sample program and use the command MVN package:

This command generates an hcp-cf-mongodb-tutorial-1.0-snapshot.jar:

3. Edit manifest.yml and specify the application name to deploy to SAP cloud platform:

4. Deploy cf push.

Once deployed, the app can be seen in Cockpit:

Accessing the application, you can see the following output:

This output is generated by RootController:

For more of Jerry’s original technical articles, please follow the public account “Wang Zixi” or scan the following QR code: