skip to Main Content

Mongodb – The signature '(inputId: number): ObjectId' of 'ObjectId' is deprecated, use static createFromTime() to set a numeric value for the new ObjectId

I am trying to fetch a single product using ObjectId, but wherenever I am writing the code: const { ObjectId } = require('mongodb'); static findById(product_id) { // console.log("Collected product id:",product_id); //db is the database return db.collection('Product_data').find({"_id":new ObjectId(product_id)}).next() .then(singleData=>{ return singleData;…

VIEW QUESTION
Back To Top
Search