mercredi 24 juillet 2019

How to use MongoDb specific operator $size to find array size greater than, less than, between and not equal to a value in Laravel / jenssegers?

I am working on a Laravel dynamic where clause eloquent model. I want to find the collection with the size of an array field having size values greater than, less than, between and not equal to.

I am using jenssegers and in the jenssegers documentation, the code to find documents with array size to a specific value is given, but I need to use it to find <,>,!= and between.

User::where('tags', 'size', 3)->get();

I can't use aggregate and $where since I am using a dynamic where clause to find the desired result.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire