-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Improve] mongodb connector v2 add source query capability #3697
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
20a284f
[Improve] mongodb connector v2 add source query capability
MonsterChenzhuo 441f9cf
fix
MonsterChenzhuo fdc3df7
fix
MonsterChenzhuo c733ef0
fix
MonsterChenzhuo 028fe2a
Merge branch 'dev' into mongodb
MonsterChenzhuo 152b7ed
fix
MonsterChenzhuo ba3b46d
fix
MonsterChenzhuo ab03bc3
add e2e
MonsterChenzhuo 2f50c23
fix
MonsterChenzhuo b34a20f
fix
MonsterChenzhuo 7c57a73
Update MongodbMatchQueryIT.java
MonsterChenzhuo fc30e5e
fix e2e
MonsterChenzhuo e7d8623
fix e2e
MonsterChenzhuo 72f4213
fix e2e
MonsterChenzhuo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/config/MongodbOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.connectors.seatunnel.mongodb.config; | ||
|
||
import org.apache.seatunnel.api.configuration.Option; | ||
import org.apache.seatunnel.api.configuration.Options; | ||
|
||
public class MongodbOption { | ||
public static final Option<String> URI = | ||
Options.key("uri") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription("MongoDB uri"); | ||
|
||
public static final Option<String> DATABASE = | ||
Options.key("database") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription("MongoDB database name"); | ||
|
||
public static final Option<String> COLLECTION = | ||
Options.key("collection") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription("MongoDB collection"); | ||
|
||
public static final Option<String> MATCHQUERY = | ||
Options.key("matchQuery") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription("MatchQuery is a JSON string that specifies the selection criteria using query operators for the documents to be returned from the collection.\n"); | ||
|
||
// Don't use now | ||
public static final String FORMAT = "format"; | ||
|
||
// Don't use now | ||
public static final String DEFAULT_FORMAT = "json"; | ||
} |
33 changes: 0 additions & 33 deletions
33
...main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/config/MongodbParameters.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the json in hocon value can be parse normally, maybe you should change a way, like use object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This place is a string, except that this string has to conform to a certain format in order to be transformed into a BsonDocument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core is this method:
.find(Optional.ofNullable(params.getMatchQuery()).isPresent() ? BsonDocument.parse(params.getMatchQuery()) : new BsonDocument())
I have tested in my development env example mode, it is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I consider one thing is: the query statement is best to conform to the native syntax of mongodb, this will be very friendly to the developer, he does not need to learn anything extra, directly paste the history of mongodb query statement can be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for me, please update e2e test case. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review,I have made the changes.