Skip to content
Components

Mapping Examples

Document ```javascript { "_id" : ObjectId("5716054bee6e764c94fa7ddd"), "name" : "MongoDB extractor" } ```
Document in Strict Mode ```json { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" }, "name": "MongoDB extractor" } ```
Mapping ```json { "_id.$oid": "id", "name": "name" } ```
Output

extractors

idname
5716054bee6e764c94fa7dddMongoDB extractor
Document ```javascript { "_id" : ObjectId("5716054bee6e764c94fa7ddd") } ```
Document in Strict Mode ```json { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" } } ```
Mapping ```json { "_id.$oid": { "type": "column", "mapping": { "destination": "id", "primaryKey": true } } } ```
Output

extractors

id (marked as PK)
5716054bee6e764c94fa7ddd
Document ```javascript { "_id" : ObjectId("5716054bee6e764c94fa7ddd"), "name" : "MongoDB extractor", "revisions" : [ { "id" : "1c6262e", "desc" : "First version" }, { "id" : "68fc980", "desc" : "Second version" } ], "status" : { "isActive" : 1, "isDeleted" : 0 } } ```
Document in Strict Mode ```json { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" }, "name": "MongoDB extractor", "revisions": [ { "id": "1c6262e", "desc": "First version" }, { "id": "68fc980", "desc": "Second version" } ], "status": { "isActive": 1, "isDeleted": 0 } } ```
Mapping ```json { "_id.$oid": { "type": "column", "mapping": { "destination": "id", "primaryKey": true } }, "name": "name", "status.isActive": "isActive", "status.isDeleted": "isDeleted", "revisions": { "type": "table", "destination": "extractors-revisions", "tableMapping": { "id": "id", "desc": "desc" } } } ```
Output

extractors

id (marked as PK)nameisActiveisDeleted
5716054bee6e764c94fa7dddMongoDB extractor10

extractors-revisions

iddescextractors_pk
1c6262eFirst version5716054bee6e764c94fa7ddd
68fc980Second version5716054bee6e764c94fa7ddd

As you can see, joining these two tables will be very easy.

Document ```javascript { "_id" : ObjectId("5716054bee6e764c94fa7ddd"), "name" : "MongoDB extractor", "revisions" : [ { "id" : "1c6262e", "desc" : "First version" }, { "id" : "68fc980", "desc" : "Second version" } ], "status" : { "isActive" : 1, "isDeleted" : 0 } } ```
Document in Strict Mode ```json { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" }, "name": "MongoDB extractor", "revisions": [ { "id": "1c6262e", "desc": "First version" }, { "id": "68fc980", "desc": "Second version" } ], "status": { "isActive": 1, "isDeleted": 0 } } ```
Mapping ```json { "_id.$oid": { "type": "column", "mapping": { "destination": "id", "primaryKey": true } }, "name": "name", "status.isActive": "isActive", "status.isDeleted": "isDeleted", "revisions.0.desc": "revision0", "revisions.1.desc": "revision1" } ```

The numbers after the “revision” array define the position of the object in the array. 0 is the first position.

Output

extractors

id (marked as PK)nameisActiveisDeletedrevision0revision1
5716054bee6e764c94fa7dddMongoDB extractor10First versionSecond version

As you can see, the values from the “revisions” array are stored in the columns of the “extractors” table.

Document ```javascript { "_id" : ObjectId("5716054bee6e764c94fa7ddd"), "name" : "MongoDB extractor", "tags" : [ "keboola", "extractor", "mongodb" ] } ```
Document in Strict Mode ```json { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" }, "name": "MongoDB extractor", "tags": [ "keboola", "extractor", "mongodb" ] } ```
Mapping ```json { "_id.$oid": { "type": "column", "mapping": { "destination": "id", "primaryKey": true } }, "name": "name", "tags": { "type": "table", "destination": "extractors-tags", "tableMapping": { ".": { "mapping": { "destination": "tag" } } } } } ```
Output

extractors

id (marked as PK)name
5716054bee6e764c94fa7dddMongoDB extractor

extractors-tags

tagextractors_pk
keboola5716054bee6e764c94fa7ddd
extractor5716054bee6e764c94fa7ddd
mongodb5716054bee6e764c94fa7ddd
Documents ```javascript [ { "_id" : ObjectId("764c94fa7ddd5716054bee6e"), "name" : "MySQL extractor", "isActive" : false } { "_id" : ObjectId("5716054bee6e764c94fa7ddd"), "name" : "MongoDB extractor", "isActive" : true } ] ```
Documents in Strict Mode ```json [ { "_id": { "$oid" : "764c94fa7ddd5716054bee6e" }, "name": "MySQL extractor", "isActive": false }, { "_id": { "$oid" : "5716054bee6e764c94fa7ddd" }, "name": "MongoDB extractor", "isActive": true } ] ```
Mapping ```json { "_id.$oid": { "type": "column", "mapping": { "destination": "id", "primaryKey": true } }, "isActive": "isActive" } ```
Output

extractors

id (marked as PK)nameisActive
764c94fa7ddd5716054bee6eMySQL extractor(empty string)
5716054bee6e764c94fa7dddMongoDB extractor1
Ask Kai

Ask anything about Keboola — I'll search the docs and cite the pages I use.