public void DropById() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; dynamic result = R.Db(DatabaseName).Table(TableName).Get(id).Delete().Run(connection); return(result); }); }
public void DoAggregation() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; var result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"] .Group("Period").Avg("OutstandingBal").Round().Run(connection); return(result); }); }
public void GetReports() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; JArray result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"] .Run <JObject>(connection); return(result); }); }
public void GetIds() { RethinkQuery.RunQuery((R, connection) => { String json = "["; RethinkQuery.GetIds(R, connection).ForEach(item => json += item + ","); json = json.TrimEnd(','); return(json + "]"); }); }
public void GetOrderedByOutstandingBal() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; dynamic result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"] .Filter(x => x.G("OutstandingBal").Gt(0)) .OrderBy(R.Desc("OutstandingBal")).Run(connection); return(result); }); }
public void SetPropVal() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; JArray reports = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"].Run <JObject>(connection); List <JObject> _reports = new List <JObject>(reports.Values <JObject>()); _reports.ForEach(report => report["PropertyValue"] = 200000); dynamic result = R.Db(DatabaseName).Table(TableName).Get(id) .Update(R.HashMap("_reports", R.HashMap("FBA Base", _reports))).Run(connection); return(result); }); }
public void DoStatFunctions() { RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; var balances = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"]["OutstandingBal"]; var min = balances.Min().Round().Run(connection); var max = balances.Max().Round().Run(connection); var avg = balances.Avg().Round().Run(connection); return("[" + min + "," + max + "," + avg + "]"); }); }
public void CountReports() { const string DatabaseName = RethinkQuery.DatabaseName; const string TableName = RethinkQuery.TableName; RethinkQuery.RunQuery((R, connection) => { String id = RethinkQuery.GetIds(R, connection)[0]; dynamic result = R.Db(DatabaseName).Table(TableName) .Count().Run(connection); return(result); }); }