Support the ongoing development of Laravel.io →
Database Eloquent Forms

DB::connection('mongodb') ->collection('XXXXXXXX') ->get();

[{"_id":{"$oid":"591081bdc079160573cd37f6"},"id":"2","ab_desc":"test","ab_title":"new","ab_image":"testimg","created_at":"12","updated_at":"22"},{"_id":{"$oid":"5911605a2581b10618383d13"},"id":"3","ab_desc":"John","ab_title":"John_new","ab_image":"John_img","created_at":"","updated_at":""},{"_id":{"$oid":"59117f742581b10617362593"},"id":3,"ab_desc":"John","ab_title":"John_new","ab_image":"John_img","created_at":"","updated_at":""},{"_id":{"$oid":"591189822581b10618383d14"},"id":4,"ab_desc":"John","ab_title":"John_new","ab_image":"John_img","created_at":"","updated_at":""},{"_id":{"$oid":"591189902581b106113be2d3"},"id":5,"ab_desc":"John","ab_title":"John_new","ab_image":"John_img","created_at":"","updated_at":""}]

Note: I need like this response "_id" not nested json format, but without using for loop [ { "_id": "591081bdc079160573cd37f6", "ab_desc": "test", "ab_title": "new", "ab_image": "testimg", "created_at": "12", "updated_at": "22" } ]

and Please do the needful

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dineshin dineshin Joined 11 May 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.