Skip to content

Instantly share code, notes, and snippets.

@banyrule banyrule/explain.json Secret
Created Dec 24, 2019

Embed
What would you like to do?
mongodb aggregate explain
{
"stages" : [
{
"$cursor" : {
"query" : {
"$and" : [
{
"StartedAt" : {
"$gte" : {
"$humanTime" : "{{From}}"
}
}
},
{
"StartedAt" : {
"$lte" : {
"$humanTime" : "{{To}}"
}
}
}
]
},
"fields" : {
"InvoiceMatchId" : 1,
"RecordMatches" : 1,
"StartedAt" : 1,
"_id" : 1
},
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "KhajiitInvoiceMatch.InvoiceMatchTaskItems",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"StartedAt" : {
"$lte" : {
"$humanTime" : "{{To}}"
}
}
},
{
"StartedAt" : {
"$gte" : {
"$humanTime" : "{{From}}"
}
}
}
]
},
"winningPlan" : {
"stage" : "COLLSCAN",
"filter" : {
"$and" : [
{
"StartedAt" : {
"$lte" : {
"$humanTime" : "{{To}}"
}
}
},
{
"StartedAt" : {
"$gte" : {
"$humanTime" : "{{From}}"
}
}
}
]
},
"direction" : "forward"
},
"rejectedPlans" : []
}
}
},
{
"$unwind" : {
"path" : "$RecordMatches"
}
},
{
"$match" : {
"RecordMatches.RecordMatchModel.WasSent" : {
"$eq" : true
}
}
},
{
"$project" : {
"_id" : true,
"recordMatchItemId" : "$RecordMatches.RecordMatchItemId",
"invoiceMatchId" : "$InvoiceMatchId",
"date" : {
"$dateFromString" : {
"dateString" : {
"$dateToString" : {
"format" : "%d.%m.%Y",
"date" : "$StartedAt"
}
}
}
}
}
},
{
"$lookup" : {
"from" : "InvoiceMatchTasks",
"as" : "InvoiceMatchTask",
"localField" : "invoiceMatchId",
"foreignField" : "InvoiceMatchId",
"unwinding" : {
"preserveNullAndEmptyArrays" : false
},
"matching" : {
"$nor" : [
{
"ShopMeta.PartyId" : {
"$in" : [
"..."
]
}
}
]
}
}
},
{
"$group" : {
"_id" : "$date",
"count" : {
"$sum" : {
"$const" : 1.0
}
}
}
}
],
"ok" : 1.0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.