Database
[{"Name":"Aruba","Code":"ABW","Type":"Country","IndicatorName":"Military_expenditure","1900":0,"1961":1,"1962":0,"1963":0,"1964":0,"1965":0,"1966":0,"1967":0,"1968":0,"1969":0},{"Name":"Afghanistan","Code":"AFG","Type":"Country","IndicatorName":"Military_expenditure","1900":0,"1961":100,"1962":0,"1963":0,"1964":0,"1965":0,"1966":0,"1967":0,"1968":0,"1969":0}]
Query
db.collection.aggregate([{$project:{_id:0,years:{$filter:{input:{$objectToArray:"$$ROOT"},cond:{$and:[{$gte:["$$this.k","1900"]},{$lte:["$$this.k","2020"]}]}}}}},{$unwind:"$years"},{$group:{_id:"$years.k",total:{$sum:"$years.v"}}},{$sort:{_id:1}}])