hello! I am trying sort by array field in dotnet (c# mongoDbDrive), but without success.
mql:
db.Contact.find({})
.projection({})
.sort({"Channels.LastActiveUTC": -1})
.limit(10)
c#
public class Contact
{
public List<Channel> Channels { get; set; }
}
Public class Channel
{
public DateTime? LastActiveUTC { get; set; }
}
Db.GetCollection<Contact>("Contact").AsQueryable().OrderByDescending("Channels.LastActiveUTC").Take(10).ToList();
error: erro: System.InvalidOperationException: No property ‘Channels.LastActiveUTC’ found on type ‘Contact’