Answering my own question, it might be helpful for anyone facing this issue later.
Here is what I did:
currentDate := time.Date(2021, 1, 22, 0, 0, 0, 0, time.UTC)
someValue := "A"
matchStage := bson.D{{"$match", bson.D{{"data.date", currentDate}, {"someAttribute", someValue}}}}
projectStage := bson.D{
{"$project", bson.D{
{"_id", 0},
{"data", bson.D{
{"$filter", bson.D{
{"input", "$data"},
{"as", "df"},
{"cond", bson.D{
{"$eq", bson.A{"$$df.date", currentDate}},
}},
}},
},
}},
},
}
I added the _id also I removed the single quote around $data
Cheers
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…