In MySQL, I would simply go \"SELECT sum(pts) FROM table\" to get the sum of the pts column on the table. However, I am converting this application to MongoDB and cannot fin
Try: $m = new MongoClient(); $con = $m->selectDB("dbName")->selectCollection("collectionName"); $cond = array( array( '$group' => array( '_id' => null, 'total' => array('$sum' => '$type'), ), ) ); $out = $con->aggregate($cond); print_r($out);
More detail click here