-
Type: Question
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.5.4
-
Component/s: Querying
-
Labels:None
We are looking at 3 common possibilities for modeling star joins in a single collection to mimic OLAP / data mart models for analytics in MongoDB:
1. Fact grain embedded in the array
{
"patient_id" : 123,
"demog" :
,
"PCP" : "Dr. John Smith",
"claim_history" : [
,
,
{ "claim_id" : 4456, "claim_dt" : ISODate(“2010-01-06”), "Primary_Dx" : "323.9", "DRG" : 322, "net_pay_amt" : 552.75, "LOS" : 1 }]
}
2. Simple Array of Values (creates a M:M mapping OLAP problem)
{
_id : “joe”,
age : 23,
gpa: 3.23,
classes : [ “BUS252”, “MUS101”, “CS220” ]
}
3. Array contains a collection of references to other documents. How often do you feel that we’ll see references like this?
{
_id : “B7XF873”
"username" : “joeUser”,
"Full Name" : “Joe User”,
"Age" : 25,
“Occupation” : “Baker”
…
“Following” : [ “LLXF321”, “ADE3F44”, ... ]
}
Are these the most common models that you see or is there a recommendation from Mongo in building analytic models in Mongo?