mongorepository

Use multiple/different MongoTemplates with same Respository class

妖精的绣舞 提交于 2019-12-10 21:19:50
问题 I have a collection on three different mongo databases(same schema). So I have created a Repository for this. But is it possible that i can use different mongoTemplates(one for three different databases) but same repository class. I can create three different repository classes(one for each database), But I don't want to do this because the schema is the same on all three. Thanks 来源: https://stackoverflow.com/questions/38265818/use-multiple-different-mongotemplates-with-same-respository-class

Multiple MongoDB collection names for the same Java class

白昼怎懂夜的黑 提交于 2019-12-04 01:32:38
问题 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

Multiple MongoDB collection names for the same Java class

不问归期 提交于 2019-12-01 05:55:12
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 {