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
MongoDB does not have a single simple query for performing a sum.
In MongoDB you will need to run a special command for this. You have three options.
... so please give PHP code to make this work
No simple snippet of PHP code here, aggregation is actually a complex topic in MongoDB.
First you have to pick one of the methods (#1, #2, #3) and then you have to decide what you plan to do with the output. For example, #1 Map/Reduce, can create a new collection with the aggregates or it can return the values in line, but only 10k values can be returned. Option #2 will runs in serial and will be very slow on sharded servers. Option #3 is still in "beta" and will eventually replace #2.
In any case, all of the options will require further reading before you pick a plan of attack.