I wanted to do a query that would return the following data in mongodb

2

COLECTION GAMES

{
  id : 10,
  casa : "Sport",
  visitante : "Chapecoense",
  horario : "2017-07-20 11:00:00"
}

COLLECTION BETTER

{
  nome : "wedson",
  apostas : [
   {
     idjogo : 10,
     opcao : 1,
     valores : 1
   }
  ]
}

I wanted to do a query that would return the following

{
  nome : "wedson",
  apostas : [
   {
     idjogo : 10,
     opcao : 1,
     valores : 1,
     id : 10,
     casa : "Sport",
     visitante : "Chapecoense",
     horario : "2017-07-20 11:00:00",
   }
  ]
}

In case it would be the betting table with the complete data of the games, I did not want to register the bet with all the data with just the id and then try to pull everything I need that way, if I'm wrong correct me, but giving this idea of how to pull I am grateful:)

    
asked by anonymous 16.07.2017 / 11:26

0 answers