I want get documents using ObjectId, but it's not getting that document
For your case, you can simply wrap the payload from client in a $map to convert them into ObjectIds with $toObjectId
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,
      
    }
  }
])

Mongo Playground

I am new to MongoDB and trying to get multiple documents using ObjectId
Below I have mentioned the demo data format.
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,
  
},

]}

and my query is this
db.store.aggregate([
{
$match: {
  id: {
    $in: [
      ObjectId("63da2f1f7662144569f78ddd"),
      ObjectId("63da2f1f7662144569f78ddb"),
      ObjectId("63da2f1f7662144569f78dda")
    ]
  }
}
},
{
$group: {
  _id: null,
  totalPrice: {
    $sum: "$price"
  }
}
},
{
$project: {
  _id: 0,
  
}
}
])

and output is
[
{
"totalPrice": 150
}
]

but I'm getting objectid like this
{
  "ids": 
  ["63da2f1f7662144569f78ddd","63da2f1f7662144569f78ddb","63da2f1f7662144569f78dda"]
}

if I pass this array it's not getting any documents. How can I pass this array in place of objectids????
