I am trying to make a mapreduce view in couchbase like so. Right now my view code in couchbase server looks like this,
function(doc, meta)
{
emit(doc.content,null);
}
where I am emitting the content of a document.
so when I iterate in (var rows in result.Rows)
, I want to assign each value in the content(in JSON) to a list of a model(abc) which has the get/set for serialNumber
,uldNumber
, and assignedDate
in a class
row.key value has
{{
"serialNumber": "1",
"uldNumber": "33",
"assignedDate": "2033-02-17T09:10:38"
}}
my class looks like
public class abc
{
//[JsonProperty("serialNumber")]
public string SerialNumber { get; set; }
//[JsonProperty("uldNumber")]
public string UldNumber { get; set; }
//[JsonProperty("assignedDate")]
public DateTime AssignedDate { get; set; }
}
If I try to deserialize it like so,
JsonSerializer js = new JsonSerializer();
_abcList.Add(js.Deserialize<dynamic[]>(row));
I get "cannot convert from 'Couchbase.Views.ViewRow<dynamic>' to 'Newtonsoft.Json.JsonReader"
If i were to do this, row.Key.toString();
, I get exception error of 'Newtonsoft.Json.Linq.JObject'
"cannot convert couchbase.views.viewrow to string "
I have looked at this and this but both of these have not worked.