Can I use Mongo DB for Star Schema type of Data Model?

Hi All,

We have Oracle Star Schema. Can we migrate this Star Schema into Mongo DB ?

We have 1 Fact table and 15 dimension tables and almost all queries perform inner joins. Data in these tables are very huge.

Any pointers to blog and/or experience is highly appreciated.

‘Table of rows’ in SQL Databases equivalent to ‘Collection of documents’ in MongoDB. And Star Data Model can be represented as document with nested properties, like this:

{
  _id,
  totalA,
  totalB,
  dimentionA: {
    _id,
    dataA1,
    dataA2,
    ....
  },
  dimentionB: {
    _id,
    dataB1,
    dataB2,
    ....
  }
}

To put simply, your fact document will contain dimension documents as nested objects.
With this structure, you will not need to use any joins ($lookups), because every dimension is already joined to the fact data.

This scheme will be a perfect fit, only if the total size of such document will not exceed 16MB.

Check this OracleDB and MongoDB Comparison for more detailed overview.