nested array document aggregation takes more time

14 views
Skip to first unread message

sarika ogale

unread,
Oct 17, 2017, 5:29:13 PM10/17/17
to mongodb-user
My collection is as under,

_id: 1_1504204200000,
varId:1,
hourlyDate: 1504204200000,
hourlyValues: [
{
_minId:0,
seconds:
[
   {
    dateTime: Date,
    varlue: 12.5
    },
{
    dateTime: Date(),
    varlue: 17.5
    }
},
{
_minId:1,
seconds:
[
   {
    dateTime: Date,
    varlue: 12.5
    },
{
    dateTime: Date(),
    varlue: 17.5
    }
]

]

indexes are on varId, hourlyDate, and hourlyValues.seconds.dateTime

When we try to get the average of month, the data is huge more that 45000. So the query result iteration takes time more that 20 seconds.
How we can improve this?

Kevin Adistambha

unread,
Nov 7, 2017, 7:31:39 PM11/7/17
to mongodb-user

Hi,

It’s been a while since you posted this question. Have you managed to solve your issue?

If you still need help with this, could you please post:

  • Your MongoDB version
  • The query you tried
  • The explain() output of the query (would probably be better if it’s the output of explain('executionStats'))

You can also check out the Analyze Query Performance page and see if there’s anything helpful.

Best regards
Kevin

Reply all
Reply to author
Forward
0 new messages