[ { "$lookup": { "from": "Assessment", "localField": "assessmentId", "foreignField": "_id", "as": "assessment" } }, { "$unwind": { "path": "$assessment", "preserveNullAndEmptyArrays": true } }, { "$match": { "$and": [ { "assessmentId": { "$oid": "622072b1aaeb4e5955319304" }, "endCode": { "$ne": "" } } ] } }, { "$project": { "_id": 1, "name": { "$cond": { "if": { "$ifNull": ["$assessmentType", false] }, "then": "$assessmentType", "else": "IDRS" } }, "assessmentId": "$_id", "ok": "$assessment.type", "createdAt": 1 } } , { "$sort": { "createdAt": -1 } } ]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter