Database

[{"key":1},{"key":2}]

Query

db.collection.aggregate([{$group:{_id:"",docs:{$push:"$$ROOT"},count:{$sum:1}}}])

Result