0

supposes i have the following collection:

[{
    "_id": "124124214124",
    "providers": {
        "stackoverflow": {
            "id": 123,
            "results": [{
                "result": 1
            }, {
                "result": 2
            }, {
                "result": 3
            }, {
                "result": 4
            }, {
                "result": 5
            }, {
                "result": 6
            }, {
                "result": 7
            }, {
                "result": 8
            }]
        },
        "stackoverflow": {
            "id": 123,
            "results": [{
                "result": 1
            }, {
                "result": 2
            }, {
                "result": 3
            }, {
                "result": 4
            }, {
                "result": 5
            }, {
                "result": 6
            }, {
                "result": 7
            }, {
                "result": 8
            }]
        }
    }
}, {
    "_id": "ghfghfgh",
    "providers": {
        "stackoverflow": {
            "id": 123,
            "results": [{
                "result": 1
            }, {
                "result": 2
            }, {
                "result": 3
            }, {
                "result": 4
            }, {
                "result": 5
            }, {
                "result": 6
            }, {
                "result": 7
            }, {
                "result": 8
            }]
        },
        "stackoverflow": {
            "id": 123,
            "results": [{
                "result": 1
            }, {
                "result": 2
            }, {
                "result": 3
            }, {
                "result": 4
            }, {
                "result": 5
            }, {
                "result": 6
            }, {
                "result": 7
            }, {
                "result": 8
            }]
        }
    }
}]

I am trying to return the all the results bigger then 3 for example. How can i accomplish this?

I tried doing it with $elemMatch but from what i understood it is not possible.

This question is different from this answer because in this question i need to do the query for each property in an object.

Community
  • 1
  • 1
Aryeh Armon
  • 2,137
  • 2
  • 22
  • 37

0 Answers0