Reputation: 13162
My data on mongodb compass is like this :
I read from here : https://laravel.com/docs/5.3/queries#json-where-clauses
I try to implement json where clauses like this :
Message::where('information->seller_id', 1)
->get();
The results are not showing. Whereas the data exist
This query seems still wrong
I try read reference here : https://github.com/jenssegers/laravel-mongodb
But, I don't find it
How can I solve this problem?
Upvotes: 1
Views: 1451
Reputation: 532
To select data from inside JSON, use a .
instead of ->
Message::where('information.seller_id', 1)
->get();
Also, your data is currently a string
, and you need it to be JSON
. Just remove the quotes around it:
information : {"store_id":6,"some_other_data":"123", "seller_id":1}
Upvotes: 1