Package com.hazelcast.jet.mongodb
Class MongoSourceBuilder.Batch<T>
- java.lang.Object
-
- com.hazelcast.jet.mongodb.MongoSourceBuilder.Batch<T>
-
- Type Parameters:
T
- type of the emitted objects
- Enclosing class:
- MongoSourceBuilder
public static final class MongoSourceBuilder.Batch<T> extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchSource<T>
build()
Creates and returns the MongoDBBatchSource
.MongoSourceBuilder.Batch<org.bson.Document>
collection(java.lang.String collectionName)
Specifies from which collection connector will read documents.<T_NEW> MongoSourceBuilder.Batch<T_NEW>
collection(java.lang.String collectionName, java.lang.Class<T_NEW> mongoType)
Specifies from which collection connector will read documents.<T_NEW> MongoSourceBuilder.Batch<T_NEW>
mapFn(FunctionEx<org.bson.Document,T_NEW> mapFn)
-
-
-
Method Detail
-
mapFn
@Nonnull public <T_NEW> MongoSourceBuilder.Batch<T_NEW> mapFn(@Nonnull FunctionEx<org.bson.Document,T_NEW> mapFn)
- Type Parameters:
T_NEW
- type of the emitted object- Parameters:
mapFn
- transforms the queried document to the desired output object
-
collection
@Nonnull public MongoSourceBuilder.Batch<org.bson.Document> collection(@Nullable java.lang.String collectionName)
Specifies from which collection connector will read documents. If not invoked, then connector will look at all collections in given database.Example usage:
This function is an equivalent of calling collection(String, Class) with Document as the second argument.MongoSourceBuilder.stream(name, supplier) .collection("myCollection");
- Parameters:
collectionName
- Name of the collection that will be queried.- Returns:
- this builder
-
collection
@Nonnull public <T_NEW> MongoSourceBuilder.Batch<T_NEW> collection(java.lang.String collectionName, @Nonnull java.lang.Class<T_NEW> mongoType)
Specifies from which collection connector will read documents. If not invoked, then connector will look at all collections in given database. All documents read will be automatically parsed to user-defined type using MongoDB's standard codec registry with pojo support added.Example usage:
This function is an equivalent for calling:MongoSourceBuilder.stream(name, supplier) .collection("myCollection", MyDocumentPojo.class);
import static com.hazelcast.jet.mongodb.impl.Mappers.toClass; MongoSourceBuilder.stream(name, supplier) .collection("myCollection") .mapFn(toClass(MyuDocumentPojo.class));
- Parameters:
collectionName
- Name of the collection that will be queried.mongoType
- user defined type to which the document will be parsed.- Returns:
- this builder
-
build
@Nonnull public BatchSource<T> build()
Creates and returns the MongoDBBatchSource
.
-
-