@steevej and @Jeffrey_Yemin
I tried running it with various aggregations and I am getting the same delay. Even with a simple projection like this, it is taking around 2 minutes. Could it be related to the fact that I am using JSON and not the helper functions?
[
{
"$project":{
"upc":1,
"inventory_name":1,
"street_date":1,
"format":1,
"sub_studio":1,
"us_base":1,
"us_srp":1,
"disc_num":1,
"modified_date":1
}
}
]
I tried running this explanation query:
Document explanation = collection.aggregate(pipeline).explain(ExplainVerbosity.EXECUTION_STATS);
List<Document> stages = explanation.get("stages", List.class);
List<String> keys = Arrays.asList("queryPlanner", "winningPlan");
for (Document stage : stages) {
Document cursorStage = stage.get("$cursor", Document.class);
if (cursorStage != null) {
System.out.println(cursorStage.getEmbedded(keys, Document.class).toJson());
}
}
The explanation for this aggregation is:
{"stage": "PROJECTION_SIMPLE", "transformBy": {"cidm_retailer_type": 1, "date_sk": 1, "extd_price": 1, "format": 1, "inventory_name": 1, "invoice_id": 1, "qty": 1, "retailer_id": 1, "retailer_name": 1, "street_date": 1, "sub_studio": 1, "upc": 1, "_id": 0}, "inputStage": {"stage": "COLLSCAN", "direction": "forward"}}