Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have two diffrent object on my json file and i want to connect between them with the attribute of systemName.
how to do so?

this is how the event object look like:
and i want to get the systemName from the Systems object the contain all the systems name List.


{
    "_id" : ObjectId("5ad8764465639315a4e54e39"),
    "yellowEvents" : 1,
    "redEvents" : 1,
    "commands" : "test",
    "systemName" : "armyEG",
    "__v" : 0
}


this is how the System object look like :

{
    "_id" : ObjectId("5ad86abc6837621e309671a3"),
    "systemName" : "armyTS",
    "__v" : 0
},
{
    "_id" : ObjectId("5ad86abc6837621e309671a3"),
    "systemName" : "armyIL",
    "__v" : 0
},
{
    "_id" : ObjectId("5ad86abc6837621e309671a3"),
    "systemName" : "armyEG",
    "__v" : 0
},
{
    "_id" : ObjectId("5ad86abc6837621e309671a3"),
    "systemName" : "armyRU",
    "__v" : 0
}


What I have tried:

i have tried to do like this:

{
    "_id" : ObjectId("5ad8764465639315a4e54e39"),
    "yellowEvents" : 1,
    "redEvents" : 1,
    "commands" : "test",
    "systemName" : "System[2].systemName",
    "__v" : 0
}
Posted
Updated 21-Apr-18 7:05am

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900