Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created October 5, 2017 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/eee6d0542d2d74cfa79717d9b35d3ba2 to your computer and use it in GitHub Desktop.
Save NMZivkovic/eee6d0542d2d74cfa79717d9b35d3ba2 to your computer and use it in GitHub Desktop.
public async Task CreateIndexOnNameField()
{
var keys = Builders<User>.IndexKeys.Ascending(x => x.Name);
await _usersCollection.Indexes.CreateOneAsync(keys);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment