خرید بک لینک

Vote count: 0

I am working with a dataset which looks something like:

{
    "class_id" : 5,
    "scores" : [
        {
            "type" : "exam",
            "score" : 88.22950674232497
        },
        {...}
    ]
}

I have the following aggregate query:

db.grades.aggregate([
    { $project: 
        {_id: 0, class_id: 1, scores: {$filter: { input: "$scores", as: "score", cond: {$or: [{"score.type" : "homework"}, {"score.type" : "exam"}] }}}}
    }
])

My error is: "dotted field names are only allowed at the top level". I have also tried "$score.type" and "$$score.type" in which case I get the error '$score.type' is an invalid operator.

Any idea's how I can work around this?

asked 1 min ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 21 تير 1395 ساعت: 8:19

صفحه بندی