FindOne For Nested Document In NestJs

sample json

{
“_id”: ObjectId(“63007d00b846a15c4b9afc7c”),
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“status”: “in_use”,
“duration”: NumberInt(“10”),
“endTime”: “11:30”,
“fromTime”: “10:30”,
“date”: ISODate(“2022–08–20T00:00:00Z”),
“unitId”: ObjectId(“62d3d9bb5e5590ee1318288c”),
“planUserId”: ObjectId(“62d3ecd0f9b0eb81bfbe65bb”),
“planId”: ObjectId(“63007cffb846a15c4b9afc77”),
“isDeleted”: false,
“deletedAt”: null,
“times”: [
{
“updatedAt”: ISODate(“2022–08–20T06:19:44Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “10:39”,
“fromTime”: “10:30”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc7e”),
“turns”: [
{
“deletedAt”: null,
“isDeleted”: false,
“isCome”: false,
“turnUserId”: ObjectId(“63008759b846a15c4b9afd2b”),
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63008759b846a15c4b9afd2f”)
}
]
},
{
“updatedAt”: ISODate(“2022–08–20T11:05:23Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “10:49”,
“fromTime”: “10:40”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc81”),
“turns”: [
{
“deletedAt”: ISODate(“2022–08–20T11:05:23Z”),
“isDeleted”: true,
“isCome”: false,
“turnUserId”: ObjectId(“63008759b846a15c4b9afd2b”),
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“630089abb846a15c4b9afd4a”),
“deletedUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“updatedAt”: ISODate(“2022–08–20T11:05:23Z”)
}
]
},
{
“updatedAt”: ISODate(“2022–08–20T06:19:44Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “10:59”,
“fromTime”: “10:50”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc85”),
“turns”: [ ]
},
{
“updatedAt”: ISODate(“2022–08–20T06:19:44Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “11:09”,
“fromTime”: “11:00”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc8a”),
“turns”: [ ]
},
{
“updatedAt”: ISODate(“2022–08–20T06:19:44Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “11:19”,
“fromTime”: “11:10”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc90”),
“turns”: [ ]
},
{
“updatedAt”: ISODate(“2022–08–20T06:19:44Z”),
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“deletedAt”: null,
“isDeleted”: false,
“maxTurn”: NumberInt(“100”),
“endTime”: “11:29”,
“fromTime”: “11:20”,
“createdUserId”: ObjectId(“62bbe4640a49fabcae8076b5”),
“_id”: ObjectId(“63007d00b846a15c4b9afc97”),
“turns”: [ ]
}
],
“createdAt”: ISODate(“2022–08–20T06:19:44Z”),
“updatedAt”: ISODate(“2022–08–20T11:05:23Z”),
“__v”: NumberInt(“0”)
}

--

--

I am a Back-End Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store