I have two collections.
LogData
[{
"SId": 10,
"NoOfDaya" : 9,
"Status" : 4
}
{
"SId": 11,
"NoOfDaya" : 8,
"Status" : 2
}]
OptData
[ {
"SId": 10,
"CId": 12,
"CreatedDate": ISO(24-10-2014)
}
{
"SId": 10,
"CId": 13,
"CreatedDate": ISO(24-10-2014)
}]
Now using mongoDB I need to find the data in form
select a.SPID,a.CreatedDate,CID=(MAX(a.CID)) from OptData a
Join LogData c on a.SID=c.SID where Status>2
group by a.SPID,a.CreatedDate
LogData have 600 records whereas OPTData have 90 millions records in production. I need to update LogData frequently, that's why its in separate collection.
- Please don't suggest to keep data in one collection.
- This is same query, I asked with different approach Creating file in GridFs (MongoDb)
- Please don't suggest Joins can't be applied in mongoDB.