MongoDB Collection Source XML Example

An example data sync XML using a MongoDB Collection as a source.

1. Example Data

The following is an example of data we want to sync out of MongoDB.

test> db.Articles.find()
[
  {
    _id: ObjectId("63d812afd755fcdeed234402"),
    Name: 'Shirt',
    Price: 19.95,
    Details: { Color: 'Red', Size: 'Medium' },
    Stock: 12
  },
  {
    _id: ObjectId("63d8137bd755fcdeed234403"),
    Name: 'Shirt',
    Price: 9.95,
    Details: { Color: 'White', Size: 'Small' },
    Stock: 61
  }
]

2. XML Example

This example XML uses the following values:

1.1 XML Example

<BatchDataSyncConfig name=""MongoDB Data Source Example"" version=""1.0.0""
    xmlns=""http://www.cinchy.co"">
    <MongoCollectionDataSource connectionString=""AI+FJVIMO1HP/CkZ5yphXeJ01wjH/4ilJ8xAIPPDyxvYq0oiYnVBQrzaq2Cp5942poeDdOp"" database=""test"" collection=""Articles"" type=""find"" query=""{ &quot;Price&quot;: { &quot;$lt&quot;: 10 } }"" projection=""{
    &quot;Name&quot;: 1,
    &quot;Price&quot;: 1,
    &quot;Color&quot;: &quot;Details.Color&quot;,
    &quot;Size&quot;: &quot;Details.Size&quot;,
    &quot;Stock&quot;: 1,
    &quot;Details&quot;: 1
}"">
        <Schema>
            <Column name=""_id"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Name"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Price"" dataType=""Number"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Color"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Size"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Stock"" dataType=""Number"" isMandatory=""false"" validateData=""false""/>
            <Column name=""$"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
            <Column name=""Details"" dataType=""Text"" trimWhitespace=""true"" isMandatory=""false"" validateData=""false""/>
        </Schema>
    </MongoCollectionDataSource>

Last updated