Created
February 27, 2022 21:00
-
-
Save sezRR/bd568660235ee5582e2af9d6d8821f83 to your computer and use it in GitHub Desktop.
MongoDB Aggregate for DTO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.Todos.aggregate([ | |
{ | |
$lookup: { | |
from: "Tags", | |
localField: "tags.$id", | |
foreignField : "_id", | |
as: "tags" | |
} | |
}, | |
{ | |
$project: { | |
"tags._id":0, | |
"tags._class":0, | |
"tags.isActive":0, | |
"tags.createdAt":0 | |
} | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment