Database

db={"store":[{"id":ObjectId("63da2f1f7662144569f78ddd"),"name":"bat","price":56,},{"id":ObjectId("63da2f1f7662144569f78ddc"),"name":"ball","price":58,},{"id":ObjectId("63da2f1f7662144569f78ddb"),"name":"cap","price":100,},{"id":ObjectId("63da2f1f7662144569f78dda"),"name":"red","price":50,},]}

Query

db.store.aggregate([{$match:{$expr:{"$in":["$id",{"$map":{/** your payload from client here*/"input":["63da2f1f7662144569f78ddd","63da2f1f7662144569f78ddb","63da2f1f7662144569f78dda"],"as":"id","in":{"$toObjectId":"$$id"}}}]}}},{$group:{_id:null,totalPrice:{$sum:"$price"}}},{$project:{_id:0,}}])

Result