Vote count:
0
I have a database of 30mb size, and it has 300 documents which are stored in a single collection, and their size vary from 1mb to 10kb. I am using the new aggregation framework which comes with 2.6 and I do not have any indexes.
I have an aggregation pipeline as following:
1. $match > first query match
2. $project > exclude some fields for efficiency
3. $unwind > unwind one of the arrays
4. $unwind > unwind second array
5. $project > projection to find matching fields among two arrays with $eq
6. $match > find the matching arrays
7. $limit(50)
this pipeline above requires ~0.50 seconds. Now if I add grouping between 6th and 7th:
...
6. $match > find the matching arrays
7. $group > put the unwinded arrays together
8. $limit(50)
this query takes 30 seconds. I am using $addToSet to put the arrays together. Any ideas what might go wrong in this situation?
asked 14 secs ago
Aucun commentaire:
Enregistrer un commentaire