Validate mongo ID

PHOTO EMBED

Thu Oct 07 2021 04:46:38 GMT+0000 (UTC)

Saved by @rook12 #javascript

const mongoose = require("mongoose");

const validId = (id) => {
  return mongoose.Types.ObjectId.isValid(id);
};

module.exports = validId;
content_copyCOPY