title: how to save new record even if same record exist with status false in unique schema using mongoose node js
body: <p>Need to a save new record even if one record already exists with status false in unique schema using mongoose node js. I have one record along with <code>{status:false}</code> by updating status true to false while deleting that record. Now i try to add a new record. but new record is not crated. because i have apply <code>unique: true</code> in mongoose schema. I need to apply unique : true, but same time need to create new record if it's status false for exist one. So can anyone give some suggestion</p>
  
  <p>Mongoose, nodejs with mongoose-beautiful-unique-validator</p>
  
  <pre><code>//schema model
       var userSchema = new mongoose.Schema({
            userName: {
           type: String,
           required: true,
           unique: true
       })
  
   //save user function inside module export function
   const user= mongoose.model('userSchema');
   user.userName = fields.username;
   user.save((err, doc) =&gt; {
                   if (!err){
                       res.send(true);
                   } else {
                       console.log(err);
  
                       return;
                   }
  
                })
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>  [
     {_id: 12345, userName: 'Uday', status:false},
     {_id: 67894, userName: 'Uday', status:true}
    ]
  </code></pre>
  
  <p>Actual result:
      I got duplicate error When i try to save name with Uday with status: true</p>
  
  <pre><code> [
     {_id: 12345, userName: 'Uday', status:false},
   ]
  </code></pre>