You are creating a converter for Eclipse NoSQL that will work without a mapping annotation. You can use both ValueWriter and ValueReader.
- ValueWriter: This interface represents an instance of Value to write in a database.
- ValueReader: This interface represents how the Value will convert to Java application. This interface will use the T get(Class type) and T get(TypeSupplier typeSupplier).
- The first step is to create the converter to a custom type database, the ValueWriter.
- ValueWriter created and the Money type will save as String, then the next step is read information to Java application. As can be seen, a ValueReader implementation.
After both implementations have been completed, the last step is to register them into two files:
META-INF/services/jakarta.nosql.ValueReader
META-INF/services/jakarta.nosql.ValueWriter
- Install docker: https://www.docker.com/
- https://store.docker.com/images/mongo
- Run docker command
- Run MongoDB: verify MongoDB image name with the command
docker images
, it can be mongodb or mongo, and then execute this commanddocker run -d --name mongodb-instance -p 27017:27017 mongo
With a MongoDB instance running go to the class App and have fun.