-
| 
         I have the following long schema:     const mySchema = new mongoose.Schema({
      // some stuff, email, lastName ... etc
      firstName: {
        type: String,
        required: true,
      }
      password: {
        type: String,
        minLength: 8,
        maxLength: 120,
      }
    })And I am inside one of the routes, I want to save a document that I am editing, but I only want to skip one validation, not the entire schema, I want to skip the validation for the  Is there something that I can do in Mongoose such as:     userDoc.firstName = "new first name";
    const newDoc = await userDoc.save({ validateBeforeSave: yes, but not for firstName })Is there something like that?  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            vkarpov15
          
      
      
        Jul 2, 2022 
      
    
    Replies: 1 comment
-
| 
         Yeah, check out the pathsToSkip option for validate: https://mongoosejs.com/docs/api/document.html#document_Document-validate  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        samislam
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Yeah, check out the pathsToSkip option for validate: https://mongoosejs.com/docs/api/document.html#document_Document-validate