db.getCollection('books').aggregate({$match:{$or:[{state:1}, {state:0}]}}, { $group: {_id:null, sum : { $sum: "$price" }}})