Question: 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 string.

Answer: 
Below three methods can be used to get the string version of id.

(Here newUser is an object containing the data to be stored in the mongodb document)

```
newUser.save((err, result) => {
  if (err) console.log(err)
  else {
     console.log(result._id.toString()) //Output - 23f89k46546546453bf91
     console.log(String(result._id))    //Output - 23f89k46546546453bf91
     console.log(result._id+"")         //Output - 23f89k46546546453bf91
  }
});

```
You could use `String`

```
String(a['_id'])

```