I'm using lokijs to store some data that I will need to work with. My data is shown below. As a newbie to lokijs I've been struggling to find a way to get item_part_option_groups
array out of part
.
My code
partDb = new loki('part.json');
partData = partDb.addCollection('part');
$.get(urlHelper.createUrl('item/parts', 'part', config.partId + '.json'), function(data){
partData.insert(data);
var data = partData.find({'part':'item_part_option_groups'});
console.log(data);
});
The Data
{
"part": {
"item_part_id": 10,
"name": "Sleeve",
"has_validation": 0,
"description": "",
"is_disabled": "1",
"created": "2015-07-22T23:55:09+0000",
"updated": null,
"item_part_option_groups": [{
"item_part_option_group_id": 10,
"order_index": 0,
"description": "",
"item_part_id": 10,
"created": "2015-07-22T23:55:39+0000",
"updated": null,
"item_part_options": [{
"item_part_option_id": 8,
"name": "Sleeve Type",
"is_conform_value": 0,
"has_validation": 1,
"item_part_option_type_id": 3,
"created": "2015-07-22T23:57:24+0000",
"updated": null,
"item_part_option_values": [{
"value": "Short Sleeve",
"order_index": 0,
"item_part_option_id": 8,
"item_part_option_value_id": 7,
"item_part_option_includes": [
]
}, {
"value": "Long Sleeve",
"order_index": 0,
"item_part_option_id": 8,
"item_part_option_value_id": 8,
"item_part_option_includes": [
]
}, ]
}]
}]
}
}