Before specifically performing the query, Mongoose has a method that checks if the passed ObjectId is valid. Another point that's often useful is to perform the conversion using Mongoose's own method: mongoose.Types.ObjectId("").