Search code examples
c#mongodbindexingmongodb-.net-driver

Mongo C# strongly typed index on nested array property


Using MongoDB C# Driver 2.3, what's the strongly typed version of the following code?

database.GetCollection<GamePlay>()
    .Indexes
    .CreateOne("{ \"PartiesInGame.Username\": 1 }");

GamePlay has an IEnumerable<PartyInGame>, where PartyInGame has a public string Username { get; set; }


Solution

  • Just a heads up but for now Robert Stam has said you cannot do this at present but they are planning it for a future release you can track it here... CSHARP-1955