[ https://issues.apache.org/jira/browse/BEAM-8427?focusedWorklogId=354670&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-354670 ]
ASF GitHub Bot logged work on BEAM-8427: ---------------------------------------- Author: ASF GitHub Bot Created on: 05/Dec/19 20:56 Start Date: 05/Dec/19 20:56 Worklog Time Spent: 10m Work Description: TheNeuralBit commented on pull request #10273: [BEAM-8427] Add MongoDB to SQL documentation URL: https://github.com/apache/beam/pull/10273#discussion_r354533080 ########## File path: website/src/documentation/dsls/sql/extensions/create-external-table.md ########## @@ -308,6 +308,43 @@ Write Mode supports writing to a topic. Only simple types are supported. +## MongoDB + +### Syntax + +``` +CREATE EXTERNAL TABLE [ IF NOT EXISTS ] tableName (tableElement [, tableElement ]*) +TYPE mongodb +LOCATION 'mongodb://[HOST]:[PORT]/[DATABASE]/[COLLECTION]' +``` +* `LOCATION`: Location of the collection. + * `HOST`: Location of the MongoDB server. Can be localhost or an ip address. + When authentication is required username and password can be specified + as follows: `username:password@localhost`. + * `PORT`: Port on which MongoDB server is listening. + * `DATABASE`: Database to connect to. + * `COLLECTION`: Collection within the database. + +### Read Mode + +Read Mode supports reading from a collection. + +### Write Mode + +Write Mode supports writing to a collection. + +### Schema + +Only simple types are supported. MongoDB documents are mapped to Beam SQL types via `JsonToRow` transform. Review comment: Maybe consider adding a link to the [`JsonToRow` javadoc](https://beam.apache.org/releases/javadoc/2.16.0/org/apache/beam/sdk/transforms/JsonToRow.html). I'm not sure how to handle the version number in that link though. It looks like [in the past](https://github.com/apache/beam/commit/860f5c2439b0e5f73a7a65b714a766fb504f227f#diff-b97eb3d3c732a00577269bc09cd61297L37) we used `{{site.release_latest}}` to keep it up to date. But that also carries the risk that the transform will change name and the link will break. @apilloud or @kennknowles do you have an opinion on this? I suppose ideally our static site generator would generate this link and simultaneously validate that JsonToRow (or at least JsonToRow.html) exists. After a quick search I don't see any way to do this with jekyll but maybe I missed something. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 354670) Time Spent: 8.5h (was: 8h 20m) > [SQL] Add support for MongoDB source > ------------------------------------ > > Key: BEAM-8427 > URL: https://issues.apache.org/jira/browse/BEAM-8427 > Project: Beam > Issue Type: New Feature > Components: dsl-sql > Reporter: Kirill Kozlov > Assignee: Kirill Kozlov > Priority: Major > Fix For: 2.18.0 > > Time Spent: 8.5h > Remaining Estimate: 0h > > * Create a MongoDB table and table provider. > * Implement buildIOReader > * Support primitive types > * Implement buildIOWrite > * improve getTableStatistics -- This message was sent by Atlassian Jira (v8.3.4#803005)