'mongdb and nodejs why is ObjectId() not working?

I have written the code to fetch a specific item from database

            const itemId = req.params.id;
const query = { _id: ObjectID(itemId) };
 const item = await itemCollection.findOne(query);
            res.send(item);
});```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source