skip to Main Content

MongoDB lookup – using $lookup

so i have document for users with this structure in JSON format: [ { "_id": { "$oid": "6369aeb83ce0f8168520f42f" }, "fullname": "Jokona", "password": "$2b$10$MUAe7XIc/xtJTGVh/y1DeuShCARbwxCSejUbHaqIPZfjekNrn0.Yy", "NIK": "MT220047", "status": "active", "department": "Logistic", "position": "Management Trainee", "Group_Shift": "Non Shift", "role": "admin", "createdAt": 1667870392, "updatedAt":…

VIEW QUESTION

MongoDB : – $lookup array inside object

I have 3 collections User, Attendance, Detection User collection Document { "_id": "60dd781d4524e6c116e234d2", "workerFirstName": "AMIT", "workerSurname": "SHAH", "workerId": "1001", "locationName": "HEAD OFFICE", "workerDesignation": "IT", "workerDepartment": "IT", }, Attendance Document { "_id": "61307cee85b5055a15cf01b7", "employeeId":"60dd781d4524e6c116e234d2", "Date": "2022-11-01T00:00:00.000Z", "duration": null, "createdAs": "FULL-DAY", "detections":…

VIEW QUESTION

MongoDB lookup (join) with field in double nested array

With a MongoDB collection name department with the following structure: { "_id":99, "name":"Erick Kalewe", "faculty":"Zazio", "lecturers":[ { "lecturerID":31, "name":"Granny Kinton", "email":"[email protected]", "imparts":[ { "groupID":70, "codCourse":99 } ] }, { "lecturerID":36, "name":"Michale Dahmel", "email":"[email protected]", "imparts":[ { "groupID":100, "codCourse":60 } ] }…

VIEW QUESTION

MongoDB $lookup on array of objects with reference objectId

I have Orders collection and iam getting the data from it as shown below: [ { "_id": "628216b7b30bb8aa80c8fd1a", "promotionsDetails": { "companyTotalPrice": 27, "promotionsData": [ { "_id": "621de063bb5f9f0bf510897f", "price": 27, "companyId": "621dd85eb45ca2ae292d9a36" }, { "_id": "621de063bb5f9f0bf510897d", "price": 19, "companyId": "621dd85eb45ca2ae292d9a32" }…

VIEW QUESTION

MongoDB – How to aggregate with deeply nested arrays

I have the following MongoDB structure: Division Collection: { "_id": ObjectId("5b28cab902f28e18b863bd36"), "name": "Premier League", ... "teams": [ ObjectId("5b28cab902f28e18b863bd01"), ObjectId("5b28cab902f28e18b863bd02"), ObjectId("5b28cab902f28e18b863bd03"), ... ] ... }, ... Teams Collection: { "_id": ObjectId("5b28cab902f28e18b863bd01"), "name": "Liverpool", ... "players": [ ObjectId('5b23tmb902f28e18b863bd01'), ObjectId('5b23tmb902f28e18b863bd02'), ObjectId('5b23tmb902f28e18b863bd03'), ... ]…

VIEW QUESTION
Back To Top
Search