Load the practice collection
Run once in mongosh against a development instance with an empty metricImports practice collection.
const lab = db.getSiblingDB("keplergrid_practice")
lab.metricImports.insertMany([
{ _id: "x", payload: { "latency.p95": 42, latency: { p95: 88 }, "$quality": "measured" } },
{ _id: "y", payload: { latency: { p95: 19 } } }
])
In KeplerGrid, open keplergrid_practice.metricImports with a Read only connection.
Show the literal key alongside the nested value
Use MongoDB 5.0 or later. In Aggregation → JSON, run this projection. input sets the document in which to look up the literal key.
[
{ "$project": {
"literalP95": { "$ifNull": [
{ "$getField": { "field": "latency.p95", "input": "$payload" } }, null
] },
"nestedP95": "$payload.latency.p95",
"quality": { "$ifNull": [
{ "$getField": { "field": { "$literal": "$quality" }, "input": "$payload" } }, null
] }
} },
{ "$sort": { "_id": 1 } }
]
The first row returns literal 42, nested 88, and quality measured. The second has nested 19 and null for the missing literal keys.
Choose literal access or path traversal deliberately
Ordinary dot notation traverses nested objects. $getField reads the stated key on its input object. Wrap a dollar-prefixed field name in $literal so MongoDB treats it as text instead of an expression.
See how to turn fields whose names vary into key-value rows or revisit the related KeplerGrid walkthrough.