Conditional uniqueness

I can see 2 or 3 ways.

  1. Add isDeleted to your index.
  2. Use a partial index that exclude isDeleted:true
  3. Rather than setting isDeleted true and polluting your working set with deleted documents, move them is another collection if you are really interested in historical data.