In this artical, you have learn how to Conver String to Object ID. It is use when you run Nativ query thne you need to convert your id to objectId. let understand some code. Following code use for conver Sting To Object ID. var ObjectId = require('mongodb').ObjectID; // Your code Here. let id = '123455667dwdsedr09e9fr0fd'; // Now conver this id to Object ID. let ObjID = new ObjectId(id); Here, Now You Use ObjID in Any Native Query. Thanks.