title: Laravel - Fetching an array from MongoDB collection in laravel
body: <p>Want to fetch array on laravel, The Document is</p>
  
  <pre><code>{
      "_id" : ObjectId("5b030a1b5085321e84006eff"),
      "name" : "Amalendu kar",
      "Information" : {
              "email" : "amalkar@gmail.com",
              "comment" : "Ok",
              "website" : "example.com",
              "info" : {
                      "x" : 203,
                      "y" : 102
              },
              "versions" : [
                      "0.9.7",
                      "0.9.8",
                      "0.9.9"
              ]
      },
      "updated_at" : ISODate("2018-05-21T18:04:11Z"),
      "created_at" : ISODate("2018-05-21T18:04:11Z")
  </code></pre>
  
  <p>}</p>
  
  <p>and i ausing this command to save this </p>
  
  <pre><code>public function store(Request $request)
  {
      request()-&gt;validate([
          'name' =&gt; 'required',
          'email' =&gt; 'required',
          'website' =&gt; 'required',
          'comment' =&gt; 'required',
          'gender' =&gt; 'required',
      ]);
  
      //Data::insert($request-&gt;all());
      Data::create(['name' =&gt; $request-&gt;input('name'),
          "Information"=&gt;[              
              "email" =&gt; $request-&gt;input('email'),
              "comment" =&gt; $request-&gt;input('comment'),
              'website' =&gt;$request-&gt;input('website'),
              "info" =&gt; (object)array( "x" =&gt; 203, "y" =&gt; 102),
              "versions" =&gt; array("0.9.7", "0.9.8", "0.9.9")
          ]
      ]);
  
      return redirect('/') -&gt;with( 'success', ' Done! ');
  }
  </code></pre>
  
  <p>Now i want to fetch 'name' field and 'email' from Infromation here is the code but i am getting error.</p>
  
  <pre><code>@foreach ($data as $value)   
      &lt;h1&gt;{{ $value-&gt;name }}&lt;/h1&gt;
      {{$content[] = $value-&gt;Information }}  
      @foreach ($content as $key)
          &lt;h1&gt;{{ $key-&gt;email }}&lt;/h1&gt;
      @endforeach
  @endforeach
  </code></pre>
  
  <p>Getting this error</p>
  
  <pre><code>"htmlspecialchars() expects parameter 1 to be string,
  </code></pre>