Hello! I’m quite new Realm and having a great time with it, but I recently got stuck converting a piece of code from the C# drivers into Realm Functions code.
My goal is to get X amount of documents from a leaderboards collection, sorting them by an “experience” value inside the document (think top 100 players in a certain skill for example). This is how I did with the C# drivers:
private static async Task<List<LeaderboardPlayerEntry>> ListEntriesByExperience(Skill skill, int limit) {
var database = MongoDatabase.GlobalMongoClient.GetDatabase("leaderboards");
var collection = database.GetCollection<LeaderboardEntryDocument>("entries");
return await collection
.Aggregate()
.Project(p => new LeaderboardPlayerEntry() { Name = p._id, Skill = skill, Value = p.Experience })
.SortByDescending(s => s.Value)
.Limit(limit)
.ToListAsync();
}
Any pointers on how the same could be accomplished in Functions? Thanks!