php - MongodDB Find where fieldvalue > otherfieldvalue*0.5 -
I am using the examples given below for the mangodeb
$ where = array ('$ and' = & gt; array (array ('class' => 11), array ('mark' => 70)); $ Cursor = $ Collection-> Search ($ where); I have two fields: Population and Male_ Population Is it possible that a man's population is more than 50%? I tried it down but it does not seem to work
$ where ['$' 'and'] [] = ['male' population '= & gt; ['$ Gt' = & gt; 1000]]; $ Where ['$' 'and'] [] = ['male' population '= & gt; ['$ Gt' = & gt; 'This.population * 0.5']]; $ Cursor = $ Collection-> Search ($ where); Also tried
$ where ['$' 'and'] [] = "this.male_ population / this.population> = 0.5
I found a solution
$ where [ $ 'And' '] [] = [' $ where '= & gt; "This. $ Male_population / this.population> = 0.5"]
Comments
Post a Comment