About NoSQL Databases
This subsection discusses the main points of NoSQL databases.
The primary key is always _id.
MapForce uses JSON Schema to describe the structure of NoSQL database components. Note that in MapForce a data structure is an essential prerequisite for data mapping. Instead of fields in a database table, the user must embed a JSON schema to get a mappable structure. The schema can be user-created or auto-generated from the database content. See details in Assign JSON Schema. MongoDB supports storing a schema in the database to validate documents.
Data in JSON and BSON
BSON function library
A new bson function library is available in the Libraries window, which allows creating and manipulating BSON types. To find the bson libarary, type bson in the text box located at the bottom of the Libraries window.
In the Component Setting dialog box, only the following sections of the dialog are available for NoSQL databases: Database, Login settings, Timeout for statement execution, and Database transaction handling. The other settings are relevant only to SQL databases. To find out more about the component settings, see this topic.
Currently, there is limited support in the DB Query pane. The DB Query pane allows you to see the list of available collections in your database, but query execution is not supported.
SQL/NoSQL Where/Order Component
The SQL/NoSQL-WHERE/ORDER component: JSON-based syntax is used to filter and sort database data; the "@" sign is used instead of ":" before a parameter in the query filter. See the sample in the dialog box SQL/NoSQL-WHERE/ORDER Parameters. To find out more about syntax for querying documents in a collection, see the MongoDB documentation.
The Join component works in non-SQL mode only.
Dialog box Database Collection Target Action
NoSQL databases support four actions for target collections. When a NoSQL database is used as a target component, the button (the Action button) appears next to the collection name. The Action button changes depending on the chosen action. When you click on this button, the dialog box Database Collection Target Action opens and suggests choosing one of the four target actions: Insert, Replace, Insert or Replace, and Delete (see screenshot below).
The description of the target actions is summarized in the list below:
•The Insert action: The mapped data will be inserted into the target database in addition to the data (if any) that is already in this target database.
•The Replace action replaces the whole document in the target database if its _id matches the one in the mapped data.
•The Replace or Insert action replaces the whole document in the target database if its _id matches the one in the mapped data. Otherwise, the Insert action is performed.
•The Delete action deletes the whole document in the target database if its _id matches the one in the mapped data.