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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -