Skip to content

binarycodifier/multiple-mongodb-databases-using-spring-data

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Multiple MongoDB databases using Spring Data example

This example shows how to interact with multiple MongoDB databases using Spring Data.

It employs the analogy of a market with products it has to offer. The products and market are separate entities and on purpose reside in separate data stores.

Interestingly this is very similar to a very real world market, in a real world stock exchange (market) people/companies purchase instruments (products). Market participants do not need to know everything about the instrument, rather they need to identify the instrument and they are typically concerned about the price on the day. Most of these instruments are referenced using well known identifiers e.g. CUSIP, ISIN, etc.

Databases

  • Market
  • Product

Collection names are the same as the database names.

Branch "spring-data-mongodb-1.1.1.RELEASE_dbref_association"

The product to market association is by id, meaning that product is saved in it's own database and referenced by id in the market collection. This is exactly what we want, however tests fail when retrieving the associated product entities on market.

References:

About

Multiple MongoDB databases using Spring Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages