Package org.apache.beam.sdk.io.mongodb
Class MongoDbIO.Write
- java.lang.Object
-
- org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.bson.Document>,org.apache.beam.sdk.values.PDone>
-
- org.apache.beam.sdk.io.mongodb.MongoDbIO.Write
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.transforms.display.HasDisplayData
- Enclosing class:
- MongoDbIO
public abstract static class MongoDbIO.Write extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.bson.Document>,org.apache.beam.sdk.values.PDone>APTransformto write to a MongoDB database.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Write()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.beam.sdk.values.PDoneexpand(org.apache.beam.sdk.values.PCollection<org.bson.Document> input)voidpopulateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)MongoDbIO.WritewithBatchSize(long batchSize)Define the size of the batch to group write operations.MongoDbIO.WritewithCollection(java.lang.String collection)Sets the collection where to write data in the database.MongoDbIO.WritewithDatabase(java.lang.String database)Sets the database to use.MongoDbIO.WritewithIgnoreSSLCertificate(boolean ignoreSSLCertificate)Enable ignoreSSLCertificate for ssl for connection (allow for self signed certificates).MongoDbIO.WritewithMaxConnectionIdleTime(int maxConnectionIdleTime)Sets the maximum idle time for a pooled connection.MongoDbIO.WritewithOrdered(boolean ordered)Enables ordered bulk insertion (default: true).MongoDbIO.WritewithSSLEnabled(boolean sslEnabled)Enable ssl for connection.MongoDbIO.WritewithSSLInvalidHostNameAllowed(boolean invalidHostNameAllowed)Enable invalidHostNameAllowed for ssl for connection.MongoDbIO.WritewithUpdateConfiguration(UpdateConfiguration updateConfiguration)MongoDbIO.WritewithUri(java.lang.String uri)Define the location of the MongoDB instances using an URI.
-
-
-
Method Detail
-
withUri
public MongoDbIO.Write withUri(java.lang.String uri)
Define the location of the MongoDB instances using an URI. The URI describes the hosts to be used and some options.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.host1is the only required part of the URI. It identifies a server address to connect to.:portXis optional and defaults to:27017if not provided./databaseis the name of the database to login to and thus is only relevant if theusername: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 withwithDatabase(String).?optionsare connection options. Note that ifdatabaseis absent there is still a/required between the lasthostand the?introducing the options. Options are name=value pairs and the pairs are separated by "&". You can pass theMaxConnectionIdleTimeconnection option viawithMaxConnectionIdleTime(int).
-
withMaxConnectionIdleTime
public MongoDbIO.Write withMaxConnectionIdleTime(int maxConnectionIdleTime)
Sets the maximum idle time for a pooled connection.
-
withSSLEnabled
public MongoDbIO.Write withSSLEnabled(boolean sslEnabled)
Enable ssl for connection.
-
withSSLInvalidHostNameAllowed
public MongoDbIO.Write withSSLInvalidHostNameAllowed(boolean invalidHostNameAllowed)
Enable invalidHostNameAllowed for ssl for connection.
-
withOrdered
public MongoDbIO.Write withOrdered(boolean ordered)
Enables ordered bulk insertion (default: true).- See Also:
- specification of MongoDb CRUD operations
-
withIgnoreSSLCertificate
public MongoDbIO.Write withIgnoreSSLCertificate(boolean ignoreSSLCertificate)
Enable ignoreSSLCertificate for ssl for connection (allow for self signed certificates).
-
withDatabase
public MongoDbIO.Write withDatabase(java.lang.String database)
Sets the database to use.
-
withCollection
public MongoDbIO.Write withCollection(java.lang.String collection)
Sets the collection where to write data in the database.
-
withBatchSize
public MongoDbIO.Write withBatchSize(long batchSize)
Define the size of the batch to group write operations.
-
withUpdateConfiguration
public MongoDbIO.Write withUpdateConfiguration(UpdateConfiguration updateConfiguration)
-
expand
public org.apache.beam.sdk.values.PDone expand(org.apache.beam.sdk.values.PCollection<org.bson.Document> input)
- Specified by:
expandin classorg.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.bson.Document>,org.apache.beam.sdk.values.PDone>
-
populateDisplayData
public void populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
- Specified by:
populateDisplayDatain interfaceorg.apache.beam.sdk.transforms.display.HasDisplayData- Overrides:
populateDisplayDatain classorg.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.bson.Document>,org.apache.beam.sdk.values.PDone>
-
-