I'm using the php manual examples for mangodb like below
$where=array( '$and' => array( array(' class' =>12), array('marks'=>70) ) );
$cursor = $collection->find($where);
I have two fields: population and male_population Is it possible to do a search where male_population is greater than 50%? I tried the below but it doesn't seem to work
$where['$and'][] = ['male_population' => ['$gt' => 1000]];
$where['$and'][] = ['male_population' => ['$gt' => 'this.population*0.5']];
$cursor = $collection->find($where);
also tried
$where['$and'][] = "this.male_population/this.population >= 0.5"