Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{"key":1},{"key":2}]
Query
db.collection.aggregate([{$project:{arrayofkeyvalue:{$objectToArray:"$$ROOT"}}},{$unwind:"$arrayofkeyvalue"},{$group:{_id:null,allkeysandvalues:{$push:"$arrayofkeyvalue"}}}])
Result