title: Mongodb database with multiple unique indexes in sharded config
body: <p>I have a "users" collection in a database in mongodb. I will be using sharding.</p>
  
  <p>Other than the standard _id, there are 3 other fields that need to be indexed and unique: username, email, and account number. All 3 of these fields will not necessarily exist for every user document, in some cases none will exist.</p>
  
  <p>I'd like the fields to be indexed because users will be looked up frequently by one of these fields. I'd like the fields to be unique because this is a requirement and I'd rather not handle this logic client-side.</p>
  
  <p>I understand that mongodb does have limitations, just like any other database, but I'm hoping there's a solution because this is a fairly common setup for web applications.</p>
  
  <p>Is there an elegant solution for this scenario?</p>
  
  <p>Not sure if it matters for this question (because the question pertains to database structure), but I am using the official mongodb C# driver.</p>