0
Wie schreibe ich eine $in
Abfrage zusammen mit Aggregat in MongoDB? Ich möchte unter
SELECT name,count(something) from collection1
where name in (<<list of Array>>) and cond1 = 'false'
group by name
Wie schreibe ich eine $in
Abfrage zusammen mit Aggregat in MongoDB? Ich möchte unter
SELECT name,count(something) from collection1
where name in (<<list of Array>>) and cond1 = 'false'
group by name
Die äquivalente Mongo Abfrage eine äquivalente mongoDB Abfrage für die SQL schreiben folgt:
db.collection1.aggregate([
{ "$match": { "name": { "$in": arrayList } } },
{
"$group": {
"_id": "$name",
"count": { "$sum": "$something" }
}
}
])