Load the practice collection
Run once in mongosh against a development instance with an empty tickets practice collection.
const lab = db.getSiblingDB("keplergrid_practice")
lab.tickets.insertMany([
{ _id: 1, label: "OPS-0071 viewer issue" },
{ _id: 2, label: "SALES-1280 invoice question" },
{ _id: 3, label: "legacy ticket" },
{ _id: 4 }
])
In KeplerGrid, open keplergrid_practice.tickets with a Read only connection.
Read the capture groups from the first match
Paste the pipeline into Aggregation → JSON. The pattern anchors to the start of the label. Each pair of parentheses captures a value.
[
{ "$set": { "parsed": { "$regexFind": {
"input": { "$ifNull": ["$label", ""] },
"regex": "^([A-Z]+)-([0-9]{4}) "
} } } },
{ "$set": {
"team": { "$ifNull": [{ "$arrayElemAt": ["$parsed.captures", 0] }, null] },
"ticket": { "$ifNull": [{ "$arrayElemAt": ["$parsed.captures", 1] }, null] }
} },
{ "$sort": { "_id": 1 } }
]
The two valid rows return OPS with 0071 and SALES with 1280. The ticket stays a string, preserving leading zeroes. The other rows return null for both extracted fields.
Keep the original label while reviewing misses
Compare label with parsed, which contains the full match, its start index, and the capture array. The example handles missing and null labels. Normalize other BSON types separately if the field is mixed.
See how to split strings with a fixed delimiter or revisit the related KeplerGrid walkthrough.