v5.0 - v5.5 Data Sync Documentation
  • Overview
  • Release Notes
    • V4.5
    • V4.6
    • v4.7
    • v4.8
    • v4.9
    • v4.10
    • v4.12
    • v4.13
  • v4 Connections Installation Guide
    • v5 Connections and CLI Installation Guide
  • v4 Worker/Listener Installation Guide
    • v5 Worker/Listener Installation Guide
  • Upgrades & Config Changes
  • Builder Guide
    • Overview
    • Types of Data Syncs
    • Subscribing to Event Streams
      • Supported Stream Sources
        • Amazon Simple Queue Service (SQS)
        • Cinchy Change Data Capture
        • Data Polling
        • Kafka Topic
        • MongoDB
        • Salesforce
          • Push Topic
          • Platform Event
    • Configuring a Data Sync
      • Connections Experience & XML Config Reference
        • Info
          • Parameters
            • String Escape
        • Source Config Reference
          • Schema Columns
            • Calculated Column Examples
          • Auth Requests
          • Request Headers
          • Pagination
          • Source Filter
        • Target Destination Config Reference
          • Column Mappings
          • Target Destination Filter
        • Sync Behaviour
        • Post Sync
        • Permissions
        • Jobs
        • Connections Usage Example
      • Data Validation
      • Transformations
        • StringReplacement
      • Supported Data Sources
        • File Based Source
          • Binary File
            • Binary File Data Source Example
          • Delimited File
            • Delimited File Data Source XML Example
          • Fixed Width File
          • Excel
            • Excel Source XML Example
        • Cinchy Event Broker/CDC
          • Cinchy Event Broker/CDC XML Config Example
        • Cinchy Table
          • Cinchy Table XML Config Example
        • Cinchy Query
          • Cinchy Query Data Source Example
        • Copper
        • DB2
        • Dynamics 2015
        • Dynamics
        • DynamoDB
        • Kafka Topic
          • Apache AVRO Data Format
          • Kafka Topic Source Example
        • LDAP
        • MongoDB Collection
          • MongoDB Collection Source XML Example
        • MongoDB Collection (Cinchy Event Triggered)
        • MS SQL Server Query
        • MS SQL Server Table
        • ODBC Table
        • ODBC Query
        • Oracle Table
        • Oracle Query
        • Parquet
        • Polling Event
          • Polling Event Example
        • REST API (Cinchy Event Triggered)
        • REST API
          • REST API XML Example
        • SAP SuccessFactors
        • Salesforce Object (Bulk API)
        • Salesforce Platform Event
        • Salesforce Push Topic
        • Snowflake
          • Snowflake Source XML Example
        • SOAP 1.2 Web Service
      • Supported Sync Targets
        • Cinchy Table
        • DB2 Table
        • Dynamics
        • Kafka Topic
        • MongoDB Collection (Column Based)
        • MS SQL Server Table
        • Oracle Table
        • REST API
        • Salesforce
        • Salesforce Object
        • Snowflake Table
          • Snowflake Table Target XML Example
        • SOAP 1.2 Web Service
    • Common Design Patterns
    • Testing a Data Sync
    • Promoting a Data Sync
    • Scheduling a Data Sync
    • CLI Command List
    • Connections Functions
    • Monitoring
  • Cinchy Platform Documentation
Powered by GitBook
On this page
  • Overview
  • 1. Considerations
  • 2. Basic Parameters
  • 3. Schema
  • 3.1 Data Types

Was this helpful?

  1. Builder Guide
  2. Configuring a Data Sync
  3. Supported Data Sources

MongoDB Collection

This page details the connection configuration for using a MongoDB Collection as a data sync source.

PreviousLDAPNextMongoDB Collection Source XML Example

Last updated 2 years ago

Was this helpful?

Overview

is a scalable, flexible NoSQL document database platform known for its horizontal scaling and load balancing capabilities, which has given application developers an unprecedented level of flexibility and scalability.

Using MongoDB as a data source was added as part of Cinchy v5.5.

1. Considerations

Please review the following considerations prior to setting up your MongoDB Collection data sync source:

  • We currently only support SCRAM authentication (Mongo 4.0+).

  • Syncs are column based. This means that you must flatten the MongoDB source document prior to sync by using a projection (See section 2: Projection (JSON Object)).

  • The column names used in the source must match elements on the root object, with the exception of "$" which can be used to retrieve the full document.

  • By default, MongoDB batch size is 101.

  • By default, bulk operations size is 5000.

  • Due to a conversion of doubles to decimals that occurs during the sync process, minor data losses may occur.

  • The following data types are not supported:

    • Binary Data

    • Regular Expression

    • DBPointer

    • JavaScript

    • JavaScript code with scope

    • Symbol

    • Min Key

    • Max Key

  • The following data types are supported with conversions:

    • ObjectID is supported, but converted to string

    • Object is supported, but converted to JSON

    • Array is supported, but converted to JSON

    • Timestamp is supported, but converted to 64-bit integers

2. Basic Parameters

Input the following basic parameters for your MongoDB Collection source (Image 1):

Parameter
Description

Connection String

mongodb+srv://<username>:<password>@<mongo host URI>

Example (Against different database):

mongodb+srv://<username>:<password>@<mongo host URI>?authSource=<authentication_db>

Database

Collection

Type

Query (JSON Object)

Projection (JSON Object)

Pipeline (JSON Array of Objects)

Example Query

// query: where "Price" is less than 10

blog> db.Articles.find({ "Price": { "$lt": 10 } })
[
  {
    _id: ObjectId("63d8137bd755fcdeed234403"),
    Name: 'Shirt',
    Price: 9.95,
    Details: { Color: 'White', Size: 'Small' },
    Stock: 61
  }
]

Example Projection

// Flatten the document

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

Example Connections UI

3. Schema

Note that the Names field is Name is case sensitive and preserves spaces.

Geography and Geometry types are not supported by the MongoDB connector.

3.1 Data Types

The MongoDB Collection Data Source obtains BSON documents from MongoDB. BSON, short for Binary JSON, is a binary-encoded serialization of JSON-like documents. Like JSON, BSON sup­ports the em­bed­ding of doc­u­ments and ar­rays

with­in other documents and arrays. BSON also con­tains extensions that allow representation of data types that are not part of the JSON spec. For ex­ample BSON makes a distinction between Int32 and Int64.

The following table shows how MongoDB data types are translated in Cinchy.

MongoDB
Cinchy
Notes

Double

Number

Supported

String

Text

Supported

Object

Text (JSON)

Supported

Array

Text (JSON)

Supported

Binary Data

Binary

Unsupported

ObjectId

Text

Supported

Boolean

Bool

Supported

Date

Date

Supported

Null

-

Supported

RegEx

-

Unsupported

JavaScript

-

Unsupported

Timestamp

Number

Supported

32-bit Integer

Number

Supported

64-bit Integer

Number

Supported

Decimal28

Number

Supported

Min Key

-

Unsupported

Max Key

-

Unsupported

-

Geography

Unsupported

-

Geometry

Unsupported

This is the encrypted connection string. You can review MongoDB's Connection String guide and parameter descriptions Do not include the /[database] in your connection URL. By default services like MongoDB Atlas will automatically include it when copying the connection string. If authenticating against a database other than the admin db, please provide the name of the database associated with the user’s credentials using the authSource parameter. Example (Default):

The name of the that contains the collection listed in the "Collection" parameter. Example: "blog"

The name of your Example: "article"

The method for retrieving your data. This will be either: - db.collection.find(): This method is used to select documents in a collection when there is no need to transform (e.g. flatten or aggregate) the data. It is used for basic queries where query and projection are sufficient. - db.collection.aggregate(): This method is used when there is a need to transform the data in a collection. It is used for more complex scenarios with single or multi-stages pipelines. In general, you will yield the quickest performance by using the find method, unless you need a

A query for retrieving your data. This option appears if you have selected db.collection.find().

This option appears if you have selected db.collection.find(). Syncs are column based. This means that you must flatten the MongoDB source document prior to sync using a projection.

consists of one or more stages that process documents. This option appears if you have selected db.collection.aggregate().

Add in your applicable column(s) (Image 2). for further details on each column type.

MongoDB
See the documentation here
here.
MongoDB database
MongoDB collection.
specific aggregation operator.
Example query.
Example projection.
An aggregation pipeline
Image 2: MongoDB Source example schema