[DOCS-15242] [Server] Using { explain: true } with .aggregate() does not give as much information as .explain("allPlansExecution") Created: 13/Apr/22  Updated: 22/Jan/24

Status: Backlog
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.2.0, 4.4, 5.0.0, 5.3.0, 6.0.0

Type: Task Priority: Minor - P4
Reporter: Matthew Javaly Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: backlog, query, request, server-docs-bug-bash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 43 weeks ago

 Description   

Hello team,

I was using $lookup in an aggregation query, but using

{ explain: true }

at the end of the aggregate() method, I was having trouble getting index stats for the foreign collection i.e. the collection in the "from" part of the $lookup. The index stats for the local collection were still available using

{ explain: true }

.

However, when I ran it like explain("allPlansExecution").aggregate(...), the explain() output had index usage stats for the foreign collection as well.

For reference, you can't run a query like .aggregate(...).explain() in the Mongo shell, so you need to put explain() before aggregate() like explain(...).aggregate(...).

I had some trouble figuring out how to find the index stats for $lookup because of the difference in results between

{ explain: true }

and .explain(), so I would really appreciate if this was documented somewhere. I think the customers would appreciate it too.

Thanks,
Matt


Generated at Thu Feb 08 08:12:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.