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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community