public abstract static class MongoDbIO.Read
extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,org.apache.beam.sdk.values.PCollection<org.bson.Document>>
PTransform to read data from MongoDB.| Constructor and Description |
|---|
Read() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.beam.sdk.values.PCollection<org.bson.Document> |
expand(org.apache.beam.sdk.values.PBegin input) |
long |
getDocumentCount() |
void |
populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder) |
MongoDbIO.Read |
withBucketAuto(boolean bucketAuto)
Sets weather to use $bucketAuto or not.
|
MongoDbIO.Read |
withCollection(java.lang.String collection)
Sets the collection to consider in the database.
|
MongoDbIO.Read |
withDatabase(java.lang.String database)
Sets the database to use.
|
MongoDbIO.Read |
withFilter(java.lang.String filter)
Deprecated.
Filtering manually is discouraged. Use
with {@link FindQuery#withFilters(Bson)} as an argument to set up the projection. |
MongoDbIO.Read |
withIgnoreSSLCertificate(boolean ignoreSSLCertificate)
Enable ignoreSSLCertificate for ssl for connection (allow for self signed certificates).
|
MongoDbIO.Read |
withMaxConnectionIdleTime(int maxConnectionIdleTime)
Sets the maximum idle time for a pooled connection.
|
MongoDbIO.Read |
withNumSplits(int numSplits)
Sets the user defined number of splits.
|
MongoDbIO.Read |
withProjection(java.lang.String... fieldNames)
|
MongoDbIO.Read |
withQueryFn(org.apache.beam.sdk.transforms.SerializableFunction<com.mongodb.client.MongoCollection<org.bson.Document>,com.mongodb.client.MongoCursor<org.bson.Document>> queryBuilderFn)
Sets a queryFn.
|
MongoDbIO.Read |
withSSLEnabled(boolean sslEnabled)
Enable ssl for connection.
|
MongoDbIO.Read |
withSSLInvalidHostNameAllowed(boolean invalidHostNameAllowed)
Enable invalidHostNameAllowed for ssl for connection.
|
MongoDbIO.Read |
withUri(java.lang.String uri)
Define the location of the MongoDB instances using an URI.
|
public MongoDbIO.Read withUri(java.lang.String uri)
The format of the URI is:
mongodb://[username:password@]host1[:port1]...[,hostN[:portN]]][/[database][?options]]
Where:
mongodb:// is a required prefix to identify that this is a string in the
standard connection format.
username:password@ are optional. If given, the driver will attempt to login to
a database after connecting to a database server. For some authentication mechanisms,
only the username is specified and the password is not, in which case the ":" after the
username is left off as well.
host1 is the only required part of the URI. It identifies a server address to
connect to.
:portX is optional and defaults to :27017 if not provided.
/database is the name of the database to login to and thus is only relevant if
the username:password@ syntax is used. If not specified, the "admin" database
will be used by default. It has to be equivalent with the database you specific with
withDatabase(String).
?options are connection options. Note that if database is absent there
is still a / required between the last host and the ?
introducing the options. Options are name=value pairs and the pairs are separated by
"&". You can pass the MaxConnectionIdleTime connection option via
withMaxConnectionIdleTime(int).
public MongoDbIO.Read withMaxConnectionIdleTime(int maxConnectionIdleTime)
public MongoDbIO.Read withSSLEnabled(boolean sslEnabled)
public MongoDbIO.Read withSSLInvalidHostNameAllowed(boolean invalidHostNameAllowed)
public MongoDbIO.Read withIgnoreSSLCertificate(boolean ignoreSSLCertificate)
public MongoDbIO.Read withDatabase(java.lang.String database)
public MongoDbIO.Read withCollection(java.lang.String collection)
@Deprecated public MongoDbIO.Read withFilter(java.lang.String filter)
with {@link FindQuery#withFilters(Bson)} as an argument to set up the projection.@Deprecated public MongoDbIO.Read withProjection(java.lang.String... fieldNames)
with {@link
FindQuery#withProjection(List)} as an argument to set up the projection.public MongoDbIO.Read withNumSplits(int numSplits)
public MongoDbIO.Read withBucketAuto(boolean bucketAuto)
public MongoDbIO.Read withQueryFn(org.apache.beam.sdk.transforms.SerializableFunction<com.mongodb.client.MongoCollection<org.bson.Document>,com.mongodb.client.MongoCursor<org.bson.Document>> queryBuilderFn)
public org.apache.beam.sdk.values.PCollection<org.bson.Document> expand(org.apache.beam.sdk.values.PBegin input)
expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,org.apache.beam.sdk.values.PCollection<org.bson.Document>>public long getDocumentCount()
public void populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
populateDisplayData in interface org.apache.beam.sdk.transforms.display.HasDisplayDatapopulateDisplayData in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,org.apache.beam.sdk.values.PCollection<org.bson.Document>>