Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose check if string is objectid

var ObjectId = require('mongoose').Types.ObjectId;
ObjectId.isValid('microsoft123'); //true
ObjectId.isValid('timtomtamted'); //true
ObjectId.isValid('551137c2f9e1fac808a5f572'); //true
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #check #string #objectid
ADD COMMENT
Topic
Name
4+3 =