Skip to content

🎉 New source: MongoDb ported to java #5530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Sep 9, 2021

Conversation

irynakruk
Copy link
Contributor

What

Port MongoDB Source to Java

How

Implemented with mongodb native java driver.
Added abstraction AbstractDbSource upon AbstractRelationalDbSource, so now all non jdbc and non sql sources can depend on it.

Recommended reading order

  1. MongoDbSource.java
  2. MongoDatabase.java

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

@github-actions github-actions bot added the area/connectors Connector related issues label Aug 19, 2021
@irynakruk irynakruk changed the title Irynakruk/3428 mongodb source New source: MongoDb ported to java Aug 31, 2021
@irynakruk irynakruk changed the title New source: MongoDb ported to java 🎉 New source: MongoDb ported to java Aug 31, 2021
@irynakruk irynakruk requested a review from etsybaev August 31, 2021 11:42
@irynakruk irynakruk linked an issue Aug 31, 2021 that may be closed by this pull request
Copy link
Contributor

@etsybaev etsybaev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also make sure you have added all docs as per the checklist.
Connector's README.md
docs/SUMMARY.md
docs/integrations//.md including changelog. See changelog example
docs/integrations/README.md
airbyte-integrations/builds.md

@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Sep 1, 2021
@irynakruk irynakruk marked this pull request as ready for review September 1, 2021 11:15
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 1, 2021

/test connector=connectors/source-mongodb-new

🕑 connectors/source-mongodb-new https://github.com/airbytehq/airbyte/actions/runs/1189997410
✅ connectors/source-mongodb-new https://github.com/airbytehq/airbyte/actions/runs/1189997410

@jrhizor jrhizor temporarily deployed to more-secrets September 1, 2021 11:40 Inactive
@DoNotPanicUA DoNotPanicUA self-requested a review September 2, 2021 12:25
@irynakruk irynakruk requested a review from tuliren September 2, 2021 12:41
implementation project(':airbyte-protocol:models')
implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs)
implementation project(':airbyte-integrations:connectors:source-relational-db')
implementation group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.8'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the driver here? Is there something outside airbyte-db and MongodbDatabase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is MongoCollection, BsonType and Document classes from mongo

Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

One minor issue about the name. source-mongodb-new seems informal. Can it be renamed to something like source-mongodb-v2?

@sherifnada, FYI.

@@ -458,3 +458,9 @@
dockerRepository: airbyte/source-amazon-ads
dockerImageTag: 0.1.0
documentationUrl: https://docs.airbyte.io/integrations/sources/amazon-ads
- sourceDefinitionId: b2e713cd-cc36-4c0a-b5bd-b47cb8a0561e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove the old mongo db implementation, having two implementations is confusing to the user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed old implementation from source definitions.

@@ -49,6 +49,7 @@
| Microsoft Teams | [![source-microsoft-teams](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-microsoft-teams%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-microsoft-teams) |
| Mixpanel | [![source-mixpanel](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-mixpanel%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-mixpanel) |
| Mongo DB | [![source-mongodb](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-mongodb%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-mongodb) |
| Mongo DB new | [![source-mongodb-new](https://img.shields.io/endpoint?url=https%3A%2F%2Fdnsgjos7lj2fu.cloudfront.net%2Ftests%2Fsummary%2Fsource-mongodb-new%2Fbadge.json)](https://dnsgjos7lj2fu.cloudfront.net/tests/summary/source-mongodb-new) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Externally, this should just be called Mongo DB and should replace the existing mongo implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed old | Mongo DB | and renamed a new one to | Mongo DB | accordingly

"examples": ["admin"],
"order": 5
},
"replica_set": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this connect to both a replica set and a single node mongo db?

Can you test it using the mongodb atlas credentials in lastpass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, working on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherifnada I've updated spec.json and connection param to connect to Mongodb Atlas as it uses mongodb+srv protocol.
So now it is possible to connect to Standalone MongoDb instance, Replica Set and MongoDb Atlas Cluster as well.
I've tested it using the mongodb atlas credentials, works good.

@@ -65,6 +65,7 @@ Airbyte uses a grading system for connectors to help users understand what to ex
|[Microsoft Teams](./sources/microsoft-teams.md)| Certified |
|[Mixpanel](./sources/mixpanel.md)| Beta |
|[Mongo DB](./sources/mongodb.md)| Alpha |
|[Mongo DB new](./sources/mongodb-new.md)| Alpha |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be only one mongo db, also it should be in beta

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@github-actions github-actions bot added the area/platform issues related to the platform label Sep 3, 2021
@irynakruk irynakruk requested a review from sherifnada September 8, 2021 01:02
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 8, 2021

/test connector=connectors/source-postgres

🕑 connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/1213783567
✅ connectors/source-postgres https://github.com/airbytehq/airbyte/actions/runs/1213783567

@jrhizor jrhizor temporarily deployed to more-secrets September 8, 2021 14:47 Inactive
Copy link
Contributor

@sherifnada sherifnada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 9, 2021

/test connector=connectors/source-bigquery

🕑 connectors/source-bigquery https://github.com/airbytehq/airbyte/actions/runs/1215407854
✅ connectors/source-bigquery https://github.com/airbytehq/airbyte/actions/runs/1215407854

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 00:26 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 00:57 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 9, 2021

/test connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1215523637
✅ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1215523637

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 01:17 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 9, 2021

/publish connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1215591690
✅ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1215591690

@jrhizor jrhizor temporarily deployed to more-secrets September 9, 2021 01:51 Inactive
@irynakruk irynakruk merged commit ffecc1c into master Sep 9, 2021
@irynakruk irynakruk deleted the irynakruk/3428-mongodb-source branch September 9, 2021 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port MongoDB Source to Java
6 participants