Skip to main content

How To Conver Normal ID to ObjectID in NodeJS MongoDB | node-js-tutorial.blogspot.com

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.

Comments

  1. Nice Post and informative data. Thank you very much for sharing this good article, it was so nice to read and useful for improving my knowledge as an update, keep blogging.
    Node JS Online training
    Node JS training in Hyderabad

    ReplyDelete
  2. Thanks for sharing the blog about how to convert normal id to object id in Nodejs. If you want to Hire Nodejs Developers
    then you should understand the basics of nodejs development

    ReplyDelete
  3. Harrah's Lake Tahoe Casino & Hotel - JTA Hub
    Harrah's Lake 영천 출장샵 Tahoe is 세종특별자치 출장마사지 an 아산 출장마사지 all new casino in the South Lake Tahoe area. This 논산 출장샵 hotel features more than 1,800 rooms, 통영 출장마사지 suites, restaurants and more

    ReplyDelete

Post a Comment