Reputation: 355
I created an embedded map trough Java in the following way:
Map<String,Object> mapObjectToInsert = new HashMap<String, Object>();
mapObjectToInsert.put("attr1",1);
mapObjectToInsert.put("attr2","bla");
ODocument doc = new ODocument("testClass");
doc.field("postUrl","11");
doc.field("jsonData",mapObjectToInsert);
doc.save();
and now I have the following embedded map:
{
"result": [
{
"@type": "d",
"@rid": "#14:0",
"@version": 1,
"@class": "testClass",
"postUrl": "11",
"postCategory": "#13:37",
"postDateImported": "2015-04-28 15:10:38",
"isBusniess": false,
"isPaid": false,
"postDateRead": "2015-04-28 15:10:33",
"jsonData": {
"attr1":"1"
"attr2":"bla"
},
"@fieldTypes": "postCategory=x,postDateImported=t,postDateRead=t"
}
],
"notification": "Query executed in 0.166 sec. Returned 1 record(s)"
}
I have found that
select expand(jsonData) from testClass
Gives the following (the values of the map):
{
"result": [
{
"@type": "d",
"@version": 0,
"value": "1"
},
{
"@type": "d",
"@version": 0,
"value": "bla"
}
],
"notification": "Query executed in 0.159 sec. Returned 2 record(s)"
}
But I want to be able to get the keys names from jsonData (attr1 and attr2) What is the method to do so? Thank you!
Upvotes: 1
Views: 746