Laravel Version: 9
PHP Version: 8.1
jenssegers/mongodbn: 3.9
At my model there's a field that represents an array of object, actually are instoke of my record, for example:
{ "item": "journal", "instock": [ { "warehouse": "A", "qty": 5 }, { "warehouse": "C", "qty": 15 } ]},
{ "item": "notebook", "instock": [ { "warehouse": "C", "qty": 5 } ] },
{ "item": "paper", "instock": [ { "warehouse": "A", "qty": 60 }, { "warehouse": "B", "qty": 15 } ] },
{ "item": "planner", "instock": [ { "warehouse": "A", "qty": 40 }, { "warehouse": "B", "qty": 5 } ] },
{ "item": "postcard", "instock": [ { "warehouse": "B", "qty": 15 }, { "warehouse": "C", "qty": 35 } ] }
I would retrieve all record that " warehouse=A and qty > 50 " . It's possible?
Product::query()
->where("instock.warehouse",40)
->get();