Issue
I have a object, 'docs', that is composed of objects inside of it. I trying to get a count of the number entries that have a certain value for 'exopp_rooms_id_c' and 'is_active'. This is probably really simple but I just can't seem to figure it out.
"docs": {
"0a0c45ef-2694-a081-a57c-3ea281c3a45f":{
"name":"ccc",
"exopp_rooms_id_c":"d13fd59f-5e67-06df-bd11-7f6e0892cbb1",
"is_active":"Yes"},
"0a0faf41-dc42-80f6-b614-af344df91d62":{
"name":"bbb",
"exopp_rooms_id_c":"d13fd59f-5e67-06df-bd11-7f6e0892cbb1",
"is_active":"No"},
"0a1d57c8-aef0-8d37-9da1-3d54c37e0022":{
"name":"aaa",
"exopp_rooms_id_c":"3bd54fdd-fe7d-e7a2-4791-12e0ed93df3e",
"is_active":"Yes"}
}
Solution
I believe this will give a hint.
const data = {
docs: {
'0a0c45ef-2694-a081-a57c-3ea281c3a45f': {
name: 'ccc',
exopp_rooms_id_c: 'd13fd59f-5e67-06df-bd11-7f6e0892cbb1',
is_active: 'Yes',
},
'0a0faf41-dc42-80f6-b614-af344df91d62': {
name: 'bbb',
exopp_rooms_id_c: 'd13fd59f-5e67-06df-bd11-7f6e0892cbb1',
is_active: 'No',
},
'0a1d57c8-aef0-8d37-9da1-3d54c37e0022': {
name: 'aaa',
exopp_rooms_id_c: '3bd54fdd-fe7d-e7a2-4791-12e0ed93df3e',
is_active: 'Yes',
},
},
};
for (const [key, subObjcet] of Object.entries(data.docs)) {
console.log(key, subObjcet);
}
Answered By - DanDuh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.