mongoose.Types.ObjectId.isValid() python code example
Example: js validate mongodb id
//Validate MongoDB ID
const oid = 'abcd56789012345678901234'
return oid.length === 24 && !isNaN(Number('0x' + oid))
//Validate MongoDB ID
const oid = 'abcd56789012345678901234'
return oid.length === 24 && !isNaN(Number('0x' + oid))