Hi! I need help with $lookup, aggregate and set.
I have 2 collections and I want to combine both of them. The issue is my document model
a lost of dictionaries…
Appreciate the help, Thank! Tal
The first collection
{
"_id": {
"AccountID": "920d145d",
"EntityName": "ABILITIES"
},
"EntityName": "ABILITIES",
"Fields": [{
"fieldName": "ABILITYCODE",
"SourceDataType": "Edm.String",
"KeyFlag": true
}, {
"fieldName": "ABILITYDES",
"SourceDataType": "Edm.String",
"KeyFlag": false
} ]
}
The second collection:
{
"_id": {
"$oid": "63b3eab829615d432868f67e"
},
"SourceSystem": "Priority",
"SourceDataType": "Edm.String",
"MySQLDatatype": "TINYTEXT"
},
{
"_id": {
"$oid": "63b3ed1e29615d432868f67f"
},
"SourceSystem": "Priority",
"SourceDataType": "Edm.Int64",
"MySQLDatatype": "BIGINT(64)"
}
I want to turn the first collection to this:
{
"_id": {
"AccountID": "920d145d",
"EntityName": "ABILITIES"
},
"EntityName": "ABILITIES",
"Fields": [{
"fieldName": "ABILITYCODE",
"SourceDataType": "Edm.Int64",
"MySQLDatatype": "BIGINT(64)",
"KeyFlag": true
}, {
"fieldName": "ABILITYDES",
"SourceDataType": "Edm.String",
"MySQLDatatype": "TINYTEXT",
"KeyFlag": false
} ]
}