samedi 17 octobre 2015

How to get the nested/inner array values of mongodb in laravel

I'm using mongodb in laravel 5.1 and I had the following database structure for states colection:

{
"state_name": "XXXXX",
"districts": [
            {
              "district_id": "1",
              "district_name": "AAAA"
            },
            {
               "district_id": "2",
               "district_name": "BBBBB"
            },
            {
                "district_id": "3",
                "district_name": "CCCC"
            },
  ]}

I need to get the districts as list and set in laravel select tag. How can I write query to fetch the inner array records as lists and set in laravel select tag? Please help. Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire