Answer the question
In order to leave comments, you need to log in
Sokil\Mongo - returns all fields, not just the ones you need. What method to call? Or create an array yourself?
$this->collection->find()
->fields( ['id', 'name', 'items'])
->all();
{"609428bc3d145000073560ee":{"_id":{"$id":"609428bc3d145000073560ee"},"id":2,"name":"Biopj","items":[{"id":2,"name" :"cow","price":121,"img_link":null},{"id":4,"name":"co5678998o","price":990,"img_link":"qwe"},{" id":5,"name":"co22","price":990,"img_link":"qwe"}]},"6094741f2e9d451e867d2c32":{"_id":{"$id":"6094741f2e9d451e867d2c32"}, "id":1,"name":"qwertybjnjj"}}
{{"id":2,"name":"Biopj","items":[{"id":2,"name":"cow","price":121,"img_link":null},{ "id":4,"name":"co5678998o","price":990,"img_link":"qwe"},{"id":5,"name":"co22","price":990, "img_link":"qwe"}]},{{"id":1,"name":"qwertybjnjj"}}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question