Closed mattgi closed 6 years ago
Hi @mattgi,
Thank you for your question. I hope I don't come off discouraging but the best place to get help for free is to ask questions on the RethinkDB Slack channel here: https://github.com/bchavez/RethinkDb.Driver#getting-help
Please feel free to tag me in your question in Slack and I'll try to answer it as best I can when I have some free time.
The GitHub issue tracker here is primarily reserved for source-code related issues.
Thanks, Brian
:walking_man: :walking_woman: Missing Persons - Walking in L.A.
Not a problem. I saw the getting help, signed up to slack last night, and then saw that there wasnt a specific group for C# discussion so came back here. Will just post in help
I guess.
Thanks @bchavez
@mattgi I'm facing the same issue. Did you find a solution?
Just for completeness, here is the solution we worked out in Discord. For those edge cases where you need more than four OrderBy( arg1, arg2, arg3, arg4, ...)
params:
void Main()
{
var r = RethinkDb.Driver.RethinkDB.R;
var conn = r.Connection()
.Hostname("localhost")
.Connect();
var query = r.Db("test").Table("data").OrderBy(r.Desc("Name"), r.Asc("Age"));
var result = query.RunResult<JArray>(conn);
result.Dump();
}
//OrderBy params
public static class QueryHelpers
{
public static OrderBy OrderBy(this ReqlExpr t, params ReqlExpr[] args)
{
var a = new Arguments(t);
foreach (var exp in args)
{
a.CoerceAndAdd(exp);
}
return new OrderBy(a);
}
}
Hope that helps those in the future who stumble across the issue.
:car: :blue_car: "Let the good times roll..."
Given a dynamic array of sort parameters, how does one construct what is to be passed into
OrderBy()
?e.g.
.OrderBy(doc => BuildOrder(doc, sortParameters))
wheresortParameters
would take the format:Attempts thus far have focused on trying to chain
R.Desc()
toReqlExpr
without success.Can't really find any information on how to do this in Java or C# doco or source code so any ideas would be awesome.