How to efficiently aggregate or sort 40K documents using Mongo?

Viewed 20

Is it possible to efficiently aggregate or sort 40K documents in Mongo? (For example, aggregate all documents within 15 seconds)?

A document:

   { Type: 'Foo',
     input1: 5,
     input2: 2.2,
     input3: { 
        val1: 3 },
     output1: 7 }

I do have indexes on all the fields that would be used for filtering or sorting.

An example aggregation would be to create buckets for input1 (from 0 to 10), and find the average of output1 for each bucket.

I gather that Mongo may not be the best tool for this. Is there an in-memory DB or something similar that is better? Currently hosted on MongoDB Atlas. Is there a simple tool that can leverage 8 CPU's in a Macbook Pro? Or perhaps something hosted? I gather Redshift can do this but that seems like overkill.

This is for a Rails app that is currently using Mongoid.

0 Answers
Related