How do you convert a string to ObjectId in Mongoose

I have a guid in string format, but how do I convert it to a MongoDB objectId using Mongoose?
You can convert strings to objectId using the following command
var myObjectId = mongoose.Types.ObjectId(stringId);
mongodb
Check out more questions and answers here