Document database arrays
Data Management's MongoDB Array Updater and Cosmos DB Array Updater tools can alter existing documents in a collection by adding data to an array as an atomic document database operation (MongoDB syntax $addToSet
and $push
). In addition, documents containing arrays can be broken apart into separate, related records, with arrays extracted as a series of records sent to child connectors. For example, consider a document like the following:
{
"_id": ObjectId("5aaa9a6510fa17c3390565d4"),
"full_name": "Bucky Morrison",
"first_name": "Bucky",
"last_name": "Morrison",
"email_address": "bucky.morrison@mail.com",
"home_phone_num": "405-532-1123",
"address_1": "Rr 1 Box 71",
"city": "Ripley",
"state_province": "MN",
"postal_code_1": "74062",
"candidate_keys": [
{
"key_value": "bucky.morrison@mail.com"
},
{
"key_value": "405-532-1123"
},
{
"key_value": "0FC82E14276DB0F415CE1479898E2243"
}
]
}
In the example above, the candidate_keys
field contains an array of documents. If you output this field directly to the main record, the only option is to map it to a large Unicode field, where it will be formatted as JSON. However, the Enable array inputs tool option lets you output these sub-documents to a child output instead, where they will be linked by synthetic relational keys.
Similarly, you can configure document output tools like the Document Injector tool with array mappings that can receive records from main and child inputs.
The main input contains the linkage field (
__LINKAGE
by default) with ascending integer values.Each child input contains the configured Input field. The expected type of this field depends on the contents of the child array that was analyzed. It may be Document or a scalar type.
Each child input also contains the linkage field (
__LINKAGE
by default) with ascending integer values that match the parent records.
If you want to inject child documents, but your child data sources are flat records, you must first turn each child record into a Document using an upstream Document Injector tool, and then map the resulting document as the input field.
There is currently no way to directly inject two-dimensional or higher arrays.