banking-kata-java icon indicating copy to clipboard operation
banking-kata-java copied to clipboard

#34 BankAccountRepository - MongoDB

Open eamtalu opened this issue 2 years ago • 0 comments

Hi Valentina,

Hope you are well. Based on your last meetup talk, I have been able to understand the persistence and further worked a little bit on the following for this issue - #34 BankAccountRepository - MongoDB. This is so interesting to me. I have been able to grab a good understanding on mongodb(document) and its spring repository(mongo template).

I hope this seems okay. But May I request you to have a look and see if it is the right way to do it. I have done the following in this PR:

  1. Added Gradle dependency for mongo template
  2. Added mongodb and mongodb-express(mongodb admin tool) in the docker-compose while I was working, tested okay.
  3. Updated ci.yaml file for mongo-db(you may discard it, if it is not needed). I was not able to test it.
  4. Updated application.yml file with mongo environment variable.
  5. Under infra--Persistence: Added class - BankAccountDocument (naming convention could be wrong, but I found it relevant as mongo consider document only where string,localdate are the datatype. I understood string seems to be the only datatype. although there are few but string seems to me the dominant.
  6. Added two repository class: one is custom using mongotemplate and alternatively other one is mongorepository. MongoTemplate seems provide better control as per my understanding.
  7. Added implementation class of - MongoBankAccountStorage.

Note: Since there are two implementation of BankAccountStorage, therefore two beans for it. I believe there could be toggle in application.yml. For the time being to compile okay, I just made your jpabankaccountstorage as @primary bean.

So, these are above I have done, for your kind review. I apologise if any mistake and would appreciate your kind advice for rework and further enhancement.

Many Thanks, Amin

eamtalu avatar Jun 29 '22 23:06 eamtalu