Multiple MongoDB collection names for the same Jav

2019-02-23 02:54发布

I am using Spring's MongoRespository. I have one class but it is called by two methods and I want to store that class in Mongo based on which method called it. How would I differentiate how it was used by having two different collections based on that one class in mongo?

Right now I have my have two repository interfaces in my dao.

public interface PastOpportunityRepository extends MongoRepository<DMOpportunity, String>,       CustomPastOpportunityRepository {}

and

public interface PredictiveOpportunityRepository extends MongoRepository<DMOpportunity, String>, CustomPredictiveOpportunityRepository {`

I want to avoid making two differently named classes with the same code.

1条回答
登录 后发表回答