I want to convert ObjectID (Mongodb) to String in JavaScript. When I get a Object form MongoDB. it like as a object has: timestamp, second, inc, machine. I can\'t convert to
In Js do simply: _id.toString()
_id.toString()
For example:
const myMongoDbObjId = ObjectID('someId'); const strId = myMongoDbObjId.toString(); console.log(typeof strId); // string