In PHP -> MongoDB, how do I return a field as a calculated value?
$this->Collection = $this->db->$theDB;  
$cursor = $this->Collection-&g开发者_开发问答t;find();
For example, one of my fields is date of birth:
DOB : 1/1/1980
Instead, I want to get back the AGE. Current Date - DOB = AGE.
Is this possible / how?
You could do a map-reduce and process the age like that
No, it is not possible.
How about just create method that will return to you age from dob?
getAgeFromDOB(date dob)
{
  return Current Date - dob;
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论