From this implementation, the service only utilizes one Repository. What do I do if I have two different databases (maybe, Mongo as main storage and Elastic for search)? How would I create and use a service that would have getUsers() (Mongo) and searchUser() (Elastic)?
Thanks for your article.
From this implementation, the service only utilizes one
Repository
. What do I do if I have two different databases (maybe, Mongo as main storage and Elastic for search)? How would I create and use a service that would havegetUsers()
(Mongo) andsearchUser()
(Elastic)?Here your service can receive over one Repository. One implemented using Mongo (userRepo) and other using Elastic (userSearch):
I think this could be a valid solution