Hello, here the correct sample for _id:5acc307fd734b019b873e90c
{
"_id" : ObjectId("5acc307fd734b019b873e90c"),
"title" : "Listen To Your Heart",
"artists" : [
{
"artist" : ObjectId("5acc307ad734b019b871cac8"),
"name_id" : "jft428eo3qepqgvrtvw",
"delimiter" : null
}
],
"composers" : [
{
"artist" : ObjectId("5acc307ed734b019b873d978")
},
{
"artist" : ObjectId("5acc307ad734b019b8728a0e")
}
],
"search_terms" : [
{
"term" : "listentoyourheart"
}
],
"legacy_id" : 16679,
"legacy_artists" : "Roxette",
"legacy_composers" : "Per HĆ„kan Gessle / Mats Persson",
"sources" : [
{
"source" : "https://www.discogs.com/Roxette-Listen-To-Your-Heart/release/1404673"
},
{
"source" : "https://en.wikipedia.org/wiki/Listen_to_Your_Heart_(Roxette_song)"
},
{
"source" : "https://de.wikipedia.org/wiki/Listen_to_Your_Heart"
}
],
"cover_count" : 16,
"covers" : [
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b0")
},
{
"relation" : {
"relation_type" : "A",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2022-03-06T22:38:31.640Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5ae38d4ec8b438ca3f4a4e51")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2022-03-18T21:12:46.044Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9aa")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b2")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9af")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2023-01-13T16:55:41.785Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b1")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ae")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2021-11-10T07:34:55.744Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a9")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-04-20T14:35:05.514Z"),
"updatedAt" : ISODate("2022-04-20T14:35:22.944Z")
},
"song" : ObjectId("626019f251685b0de4874798")
},
{
"relation" : {
"relation_type" : "M",
"correct" : true,
"timestamps" : [
{
"original" : "00:23",
"cover" : "01:22"
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-03-20T10:55:47.538Z"),
"updatedAt" : ISODate("2022-03-20T10:56:18.275Z")
},
"song" : ObjectId("6236ff8405189150766ebcdc")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ad")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ac")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ab")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a8")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2021-11-09T22:31:55.385Z"),
"updatedAt" : ISODate("2021-11-09T22:31:55.385Z")
},
"song" : ObjectId("618af6c3a151e6db261f93a8")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T05:41:01.337Z"),
"updatedAt" : ISODate("2022-08-30T05:42:41.476Z")
},
"song" : ObjectId("630da214ee9bd995ee18bba5")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2023-01-06T18:08:37.450Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a7")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-17T12:18:27.292Z"),
"updatedAt" : ISODate("2022-08-17T12:19:30.931Z")
},
"song" : ObjectId("62fcdc699336888e0e569e25")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-07-31T07:01:47.859Z"),
"updatedAt" : ISODate("2022-07-31T07:01:47.859Z")
},
"song" : ObjectId("62e6285dd1aee7826833d486")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T05:25:01.705Z"),
"updatedAt" : ISODate("2022-08-30T05:25:01.705Z")
},
"song" : ObjectId("630d9e1cee9bd995ee184386")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a6")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T09:20:57.658Z"),
"updatedAt" : ISODate("2022-08-30T09:20:57.658Z")
},
"song" : ObjectId("630dd5c5ee9bd995ee1e967e")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T09:27:46.987Z"),
"updatedAt" : ISODate("2022-08-30T09:27:46.987Z")
},
"song" : ObjectId("630dd784ee9bd995ee1ecb91")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2020-08-03T19:34:16.244Z"),
"updatedAt" : ISODate("2020-08-03T19:37:31.340Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5f286613520cbf88170d8d7d")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T09:38:54.379Z"),
"updatedAt" : ISODate("2022-08-30T09:38:54.379Z")
},
"song" : ObjectId("630dd93eee9bd995ee1efed0")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-02-15T20:23:56.733Z"),
"updatedAt" : ISODate("2022-02-15T20:23:56.733Z")
},
"song" : ObjectId("620c0a59b0343c2ea9456d3d")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2021-09-13T05:55:42.481Z"),
"updatedAt" : ISODate("2021-10-09T05:28:12.389Z")
},
"song" : ObjectId("613ee736d6db78d96a0b160c")
},
{
"relation" : {
"relation_type" : "C",
"correct" : true,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"comment_de" : "",
"comment_en" : "",
"createdAt" : ISODate("2022-08-30T06:14:05.816Z"),
"updatedAt" : ISODate("2022-08-30T06:14:05.816Z")
},
"song" : ObjectId("630daa0fee9bd995ee19a76f")
}
],
"comment_de" : "",
"editor" : "MIG",
"edited_by" : "AHO",
"note" : "",
"release_date" : "1988",
"createdAt" : ISODate("2005-05-13T22:00:00.000Z"),
"updatedAt" : ISODate("2023-01-13T16:15:17.921Z"),
"languages" : [
"eng"
],
"correct" : true,
"youtube" : {
"modified" : ISODate("2022-12-04T02:04:52.052Z"),
"autogenerated" : false,
"id" : "yCC_b5WHLX0"
},
"original_count" : 1,
"url_key" : "Roxette-Listen-To-Your-Heart",
"first_release" : {
"medium" : "7''-Vinyl",
"title" : "Listen To Your Heart",
"label" : "Parlophone",
"record_number" : "1363237",
"country" : "SE",
"track_number" : "A",
"ean" : "",
"asin" : "",
"medium_description" : "Single"
},
"folksong" : {
"identifiers" : []
},
"is_folksong" : false,
"live_version" : false,
"highlight" : {
"is" : false
},
"recorded_date" : "",
"keywords" : [
"roxette",
"listen",
"2",
"yore",
"heart",
"to",
"your"
]
}
I changed the skript:
db.getCollection('songs').aggregate([
{
$match: {
correct:true, title: "Listen To Your Heart",
createdAt : { '$gte' : ISODate('1999-02-01'), '$lte' :ISODate('2022-02-09') },
covers: {
$elemMatch: {
"relation.correct": false
}
}
}
},
{
$project: {
covers: {
$filter: {
input: "$covers",
as: "cover",
cond: { $eq: ["$$cover.relation.correct", false],
}
}
}
}
},
{
$lookup: {
from: "songs",
let: { covers_song: "$covers.song" },
pipeline: [
{
$match: {
$expr: {
$and: [
{ $eq: ["$_id", "$$covers_song"] },
{ $eq: ["$correct", true] }
]
}
}
}
],
as: "cover_songs"
}
}
the result of my query:
{
"_id" : ObjectId("5acc307fd734b019b873e90c"),
"covers" : [
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b0")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b2")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9af")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2023-01-13T16:55:41.785Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9b1")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ae")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ad")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ac")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9ab")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.336Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.336Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a8")
},
{
"relation" : {
"relation_type" : "C",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2023-01-06T18:08:37.450Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a7")
},
{
"relation" : {
"relation_type" : "Q",
"correct" : false,
"timestamps" : [
{
"original" : "",
"cover" : ""
}
],
"createdAt" : ISODate("2019-06-25T19:36:47.337Z"),
"updatedAt" : ISODate("2019-06-25T19:36:47.337Z"),
"comment_de" : "",
"comment_en" : ""
},
"song" : ObjectId("5acc308fd734b019b876b9a6")
}
],
"cover_songs" : []