Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Failed to parse explain output, make sure to highlight entire statement. #51

Open
ainthek opened this issue Aug 1, 2019 · 0 comments
Open

Comments

@ainthek
Copy link

ainthek commented Aug 1, 2019

Running windows version 1.1.0:
and testing explain for aggregate queries:
I have this query:
db.test.aggregate([
{
"$match":
{
"$or": [
{
"variables.reportedBy.code": "CRM-00000625"
},
{
"variables.contactPerson.code": "CRM-00000625"
},
{
"variables.claimant.code": "CRM-00000625"
},
{
"variables.claimant.contactRef.code": "CRM-00000625"
},
{
"variables.claimants.code": "CRM-00000625"
},
{
"variables.claimants.contactRef.code": "CRM-00000625"
},
{
"variables.reportedBy.id": "7801184523"
},
{
"variables.contactPerson.id": "7801184523"
},
{
"variables.claimant.id": "7801184523"
},
{
"variables.claimant.contactRef.id": "7801184523"
},
{
"variables.claimants.id": "7801184523"
},
{
"variables.claimants.contactRef.id": "7801184523"
}]
}
},
{
"$project":
{
"lossNotificationNumber": 1,
"status": 1,
"policyNumber": 1,
"variables.reportedBy": 1,
"variables.contactPerson": 1,
"variables.claimant": 1,
"variables.claimants": 1
}
},
{
"$addFields":
{
"_match":
{
"$cond":
{
"if":
{
"$or": [
{
"$eq": ["$variables.reportedBy.code", "CRM-00000625"]
},
{
"$eq": ["$variables.contactPerson.code", "CRM-00000625"]
},
{
"$eq": ["$variables.claimant.code", "CRM-00000625"]
},
{
"$eq": ["$variables.claimant.contactRef.code", "CRM-00000625"]
},
{
"$eq": ["$variables.claimants.code", "CRM-00000625"]
},
{
"$eq": ["$variables.claimants.contactRef.code", "CRM-00000625"]
}]
},
"then": "code",
"else": "lax"
}
}
}
}])

when clicking explain, it generates correct query (explain() before aggregate) but fails with message: Failed to parse explain output, make sure to highlight entire statement.

db.common.formtemplate.localizeddocumentform.explain().aggregate([
{
$match: {
$or: [
{ "variables.reportedBy.code": "CRM-00000625" },
{ "variables.contactPerson.code": "CRM-00000625" },
{ "variables.claimant.code": "CRM-00000625" },
{ "variables.claimant.contactRef.code": "CRM-00000625" },
{ "variables.claimants.code": "CRM-00000625" },
{ "variables.claimants.contactRef.code": "CRM-00000625" },
{ "variables.reportedBy.id": "7801184523" },
{ "variables.contactPerson.id": "7801184523" },
{ "variables.claimant.id": "7801184523" },
{ "variables.claimant.contactRef.id": "7801184523" },
{ "variables.claimants.id": "7801184523" },
{ "variables.claimants.contactRef.id": "7801184523" }
]
}
},
{
$project: {
lossNotificationNumber: 1,
status: 1,
policyNumber: 1,
"variables.reportedBy": 1,
"variables.contactPerson": 1,
"variables.claimant": 1,
"variables.claimants": 1
}
},
{
$addFields: {
_match: {
$cond: {
if: {
$or: [
{
$eq: ["$variables.reportedBy.code", "CRM-00000625"]
},
{
$eq: ["$variables.contactPerson.code", "CRM-00000625"]
},
{
$eq: ["$variables.claimant.code", "CRM-00000625"]
},
{
$eq: ["$variables.claimant.contactRef.code", "CRM-00000625"]
},
{
$eq: ["$variables.claimants.code", "CRM-00000625"]
},
{
$eq: ["$variables.claimants.contactRef.code", "CRM-00000625"]
}
]
},
then: "code",
else: "lax"
}
}
}
}
]);

when running from cli, this query retyrns:
/* 1 */
{
"stages" : [
{
"$cursor" : {
"query" : {
"$or" : [
{
"variables.reportedBy.code" : "CRM-00000625"
},
{
"variables.contactPerson.code" : "CRM-00000625"
},
{
"variables.claimant.code" : "CRM-00000625"
},
{
"variables.claimant.contactRef.code" : "CRM-00000625"
},
{
"variables.claimants.code" : "CRM-00000625"
},
{
"variables.claimants.contactRef.code" : "CRM-00000625"
},
{
"variables.reportedBy.id" : "7801184523"
},
{
"variables.contactPerson.id" : "7801184523"
},
{
"variables.claimant.id" : "7801184523"
},
{
"variables.claimant.contactRef.id" : "7801184523"
},
{
"variables.claimants.id" : "7801184523"
},
{
"variables.claimants.contactRef.id" : "7801184523"
}
]
},
"fields" : {
"lossNotificationNumber" : 1,
"policyNumber" : 1,
"status" : 1,
"variables.claimant" : 1,
"variables.claimants" : 1,
"variables.contactPerson" : 1,
"variables.reportedBy" : 1,
"_id" : 1
},
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "test",
"indexFilterSet" : false,
"parsedQuery" : {
"$or" : [
{
"variables.claimant.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimant.contactRef.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimant.contactRef.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimant.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimants.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimants.contactRef.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimants.contactRef.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimants.id" : {
"$eq" : "7801184523"
}
},
{
"variables.contactPerson.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.contactPerson.id" : {
"$eq" : "7801184523"
}
},
{
"variables.reportedBy.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.reportedBy.id" : {
"$eq" : "7801184523"
}
}
]
},
"winningPlan" : {
"stage" : "SUBPLAN",
"inputStage" : {
"stage" : "COLLSCAN",
"filter" : {
"$or" : [
{
"variables.claimant.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimant.contactRef.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimant.contactRef.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimant.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimants.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimants.contactRef.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.claimants.contactRef.id" : {
"$eq" : "7801184523"
}
},
{
"variables.claimants.id" : {
"$eq" : "7801184523"
}
},
{
"variables.contactPerson.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.contactPerson.id" : {
"$eq" : "7801184523"
}
},
{
"variables.reportedBy.code" : {
"$eq" : "CRM-00000625"
}
},
{
"variables.reportedBy.id" : {
"$eq" : "7801184523"
}
}
]
},
"direction" : "forward"
}
},
"rejectedPlans" : []
}
}
},
{
"$project" : {
"_id" : true,
"policyNumber" : true,
"status" : true,
"lossNotificationNumber" : true,
"variables" : {
"claimants" : true,
"claimant" : true,
"contactPerson" : true,
"reportedBy" : true
}
}
},
{
"$addFields" : {
"_match" : {
"$cond" : [
{
"$or" : [
{
"$eq" : [
"$variables.reportedBy.code",
{
"$const" : "CRM-00000625"
}
]
},
{
"$eq" : [
"$variables.contactPerson.code",
{
"$const" : "CRM-00000625"
}
]
},
{
"$eq" : [
"$variables.claimant.code",
{
"$const" : "CRM-00000625"
}
]
},
{
"$eq" : [
"$variables.claimant.contactRef.code",
{
"$const" : "CRM-00000625"
}
]
},
{
"$eq" : [
"$variables.claimants.code",
{
"$const" : "CRM-00000625"
}
]
},
{
"$eq" : [
"$variables.claimants.contactRef.code",
{
"$const" : "CRM-00000625"
}
]
}
]
},
{
"$const" : "code"
},
{
"$const" : "lax"
}
]
}
}
}
],
"ok" : 1.0
} whic you fail to parse. Thanx for help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant