1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| db.getCollection('form').aggregate([{ '$project': { 'name': 1, 'code': 1, 'handlerUserId': 1, 'handlerName': 1, 'reviewerUserId': 1, 'reviewerName': 1, 'createdUserId': 1, 'createdUserName': 1, 'address': 1, 'tnNumber': 1, 'createdDate': 1, 'updatedDate': 1, 'description': 1, 'formId': 1, 'formNo': 1, 'showFormNo': 1, 'jsonObject': 1, 'formTypeId': 1, 'version': 1, 'supervisorStatus': 1, 'supervisorStatusId': { $switch: { branches: [ { case: { $eq : [ '$supervisorStatus', "FORM_NOT_SUBMITTED" ] }, then: 5 }, { case: { $eq : [ '$supervisorStatus', "FORM_PROCESSING" ] }, then: 4 }, { case: { $eq : [ '$supervisorStatus', "FORM_SUBMITTED_FOR_REVIEW" ] }, then: 3 }, { case: { $eq : [ '$supervisorStatus', "FORM_APPROVED" ] }, then: 2 }, { case: { $eq : [ '$supervisorStatus', "FORM_AUDIT_WAS_REJECTED" ] }, then: 1 } ], default: 0 } } } }, { "$sort": { "weight": -1 } }, { "$skip" : 0},
{ "$limit" : 20},
])
|