Javascript String toObjectId()
'use strict';/*from ww w . j a v a 2s.c o m*/ String.prototype.toObjectId = function() { var ObjectId = (require('mongoose').Types.ObjectId); return new ObjectId(this.toString()); };
String.prototype.toObjectId = function() { var ObjectId = (require('mongoose').Types.ObjectId); return new ObjectId(this.toString()); };