// GET api/values/5 public string Get(string id) { rvService svc = new rvService(getMongoDB()); DataTableParamModel para = new DataTableParamModel(); para.sDate =Convert.ToDateTime(id); var jsonWriterSettings = new JsonWriterSettings { OutputMode = JsonOutputMode.Strict }; string rtn = svc.Read(para).ToJson(jsonWriterSettings); //rtn = "{\"data\":" + rtn + "}"; return rtn; }
public List<BsonDocument> Read(DataTableParamModel InputData) { //var rst = _collection.FindAs<Account>(Query.And(Query.GTE("review.rdate", InputData.sDate),Query.SizeGreaterThan("review",0))); var rst = _collection.FindAs<Account>(Query.SizeGreaterThan("review", 0)); // .SetFields(Fields.Include(new string[] {"","","","","","","" })); List<BsonDocument> bdoc = new List<BsonDocument>(); foreach (var row in rst) { foreach (var rv in row.review) { bdoc.Add(geneBSON(row, rv)); } } return bdoc; }