How to mount an object?

0

I would like the key and the cotação and modalidade value of the confronto collection to be in their respective objects whose id is equal in the palpites collection. How can I do this?

[{
    "_id": "59b445edc7e10e11ec8127ec",
    "palpites": [
        {
            "_id": "59b445bcc7e10e11ec8127e8",
            "campeonato": "brasil - série a",
            "casa": "chapecoense",
            "fora": "avai",
            "horario": "2017-08-11T20:00:00.000Z",
            "status": 0,
            "placar": {
                "fora": 0,
                "casa": 1
            }
        },
        {
            "_id": "59b445dfc7e10e11ec8127ea",
            "campeonato": "brasil - série a",
            "casa": "palmeiras",
            "fora": "santos",
            "horario": "2017-08-11T20:00:00.000Z",
            "status": 0,
            "placar": {
                "fora": 0,
                "casa": 1
            }
        }
    ],
    "nome": "wedson",
    "agente": "agente",
    "cotacao": 0,
    "premio": 0,
    "vencedor": 0,
    "tipo": 1,
    "usuario": "59b4459ec7e10e11ec8127e6",
    "horario": "2017-09-09T19:50:05.160Z",
    "confronto": [{
        "confronto_id": "59b445bcc7e10e11ec8127e8",
        "cotacao": 1.5,
        "modalidade": 1
    },{
        "confronto_id": "59b445dfc7e10e11ec8127ea",
        "cotacao": 2.5,
        "modalidade": 2
    }]
}]
    
asked by anonymous 09.09.2017 / 22:08

1 answer

0

Would that be?

    [{
    "_id": "59b445edc7e10e11ec8127ec",
    "palpites": [
        {
            "_id": "59b445bcc7e10e11ec8127e8",
            "campeonato": "brasil - série a",
            "casa": "chapecoense",
            "fora": "avai",
            "horario": "2017-08-11T20:00:00.000Z",
            "status": 0,
            "placar": {
                "fora": 0,
                "casa": 1
            },
            "confronto": {
                "confronto_id": "59b445bcc7e10e11ec8127e8",
                "cotacao": 1.5,
                "modalidade": 1
            }
        },
        {
            "_id": "59b445dfc7e10e11ec8127ea",
            "campeonato": "brasil - série a",
            "casa": "palmeiras",
            "fora": "santos",
            "horario": "2017-08-11T20:00:00.000Z",
            "status": 0,
            "placar": {
                "fora": 0,
                "casa": 1
            },
            "confronto": {
                "confronto_id": "59b445dfc7e10e11ec8127ea",
                "cotacao": 2.5,
                "modalidade": 2
            }
        }
    ],
    "nome": "wedson",
    "agente": "agente",
    "cotacao": 0,
    "premio": 0,
    "vencedor": 0,
    "tipo": 1,
    "usuario": "59b4459ec7e10e11ec8127e6",
    "horario": "2017-09-09T19:50:05.160Z",
    "confronto": [{
        "confronto_id": "59b445bcc7e10e11ec8127e8",
        "cotacao": 1.5,
        "modalidade": 1
    },{
        "confronto_id": "59b445dfc7e10e11ec8127ea",
        "cotacao": 2.5,
        "modalidade": 2
    }] 
}]
    
18.09.2017 / 16:35