Hi I have a requirement where I have to fetch key/value of a field from my mongodb.. I know how to map String/Int and array fields but not sure how to do for object fields, below is the sample example
My record in mongodb
{
"_id" : ObjectId("5db3460d7fb5c16ab"),
"imgId" : "abc.png",
"seq" : "20180208_122230",
"pop" : [
"0000",
"0001
],
"value" : [
"1111",
"1234"
],
"pixels" : {
"00" : NumberInt(128),
"02" : NumberInt(354),
"03" : NumberInt(1951),
"05" : NumberInt(2610),
"09" : NumberInt(3619),
"11" : NumberInt(1048),
"18" : NumberInt(3644)
}
}
I am trying to map it, my mapping file looks like :
Mapping
FROM JSON {
"sample":{
"_id": "?_id",
"imgId": "?imgId",
"seq": "?seq",
"pop": ["?pop"],
"value": ["?value"],
"pixels" : ?????
}
}
TO {
?image a :Images;
:_id ?_id;
:seq ?seq;
:pop ?pop;
:value ?value;
:pixels : ???
}
WHERE {
BIND (template("http://sample.com/images/{imgId}") AS ?image)
}
I am not sure how to map pixels field!!!
Please help..