Mongo Playground

Configuration

[{"key1":1,"key2":21},{"key1":2,"key2":232,"key3":232},{"key1":2,"key2":232,"key3":233}]

Query

db.collection.aggregate({$group:{_id:{key1:"$key1",key2:"$key2",},all:{$push:"$$ROOT"}}})

Result