T - type of the emitted objectspublic static final class MongoSourceBuilder.Batch<T> extends Object
| Modifier and Type | Method and Description | 
|---|---|
| BatchSource<T> | build()Creates and returns the MongoDB  BatchSource. | 
| MongoSourceBuilder.Batch<org.bson.Document> | collection(String collectionName)Specifies from which collection connector will read documents. | 
| <T_NEW> MongoSourceBuilder.Batch<T_NEW> | collection(String collectionName,
          Class<T_NEW> mongoType)Specifies from which collection connector will read documents. | 
| MongoSourceBuilder.Batch<T> | database(String database)Specifies which database will be queried. | 
| MongoSourceBuilder.Batch<T> | filter(org.bson.conversions.Bson filter)Adds filter aggregate to this builder, which allows to filter documents in MongoDB, without
 the need to download all documents. | 
| <T_NEW> MongoSourceBuilder.Batch<T_NEW> | mapFn(FunctionEx<org.bson.Document,T_NEW> mapFn) | 
| MongoSourceBuilder.Batch<T> | project(org.bson.conversions.Bson projection)Adds a projection aggregate. | 
| MongoSourceBuilder.Batch<T> | sort(org.bson.conversions.Bson sort)Adds sort aggregate to this builder. | 
| MongoSourceBuilder.Batch<T> | throwOnNonExisting(boolean throwOnNonExisting)If  true, the lack of database or collection will cause an error. | 
@Nonnull public MongoSourceBuilder.Batch<T> throwOnNonExisting(boolean throwOnNonExisting)
true, the lack of database or collection will cause an error.
 If false, database and collection will be automatically created.
 Default value is true.throwOnNonExisting - if exception should be thrown when database or collection does not exist.@Nonnull public MongoSourceBuilder.Batch<T> project(@Nonnull org.bson.conversions.Bson projection)
 import static com.mongodb.client.model.Projections.include;
  MongoSourceBuilder.stream(name, supplier)
      .projection(include("fieldName"));
 projection - Bson form of projection;
                   use Projections to create projection.@Nonnull public MongoSourceBuilder.Batch<T> sort(@Nonnull org.bson.conversions.Bson sort)
Example usage:
  import static com.mongodb.client.model.Sorts.ascending;
  MongoSourceBuilder.stream(name, supplier)
      .sort(ascending("fieldName"));
 sort - Bson form of sort. Use Sorts to create sort.@Nonnull public MongoSourceBuilder.Batch<T> filter(@Nonnull org.bson.conversions.Bson filter)
Example usage:
  import static com.mongodb.client.model.Filters.eq;
  MongoSourceBuilder.stream(name, supplier)
      .filter(eq("fieldName", 10));
 filter - Bson form of filter. Use Filters to create sort.@Nonnull public <T_NEW> MongoSourceBuilder.Batch<T_NEW> mapFn(@Nonnull FunctionEx<org.bson.Document,T_NEW> mapFn)
T_NEW - type of the emitted objectmapFn - transforms the queried document to the desired output
                object@Nonnull public MongoSourceBuilder.Batch<T> database(@Nullable String database)
database - database name to query.@Nonnull public MongoSourceBuilder.Batch<org.bson.Document> collection(@Nullable String collectionName)
Example usage:
  MongoSourceBuilder.stream(name, supplier)
      .collection("myCollection");
 collectionName - Name of the collection that will be queried.@Nonnull public <T_NEW> MongoSourceBuilder.Batch<T_NEW> collection(String collectionName, @Nonnull Class<T_NEW> mongoType)
Example usage:
  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));
 collectionName - Name of the collection that will be queried.mongoType - user defined type to which the document will be parsed.@Nonnull public BatchSource<T> build()
BatchSource.Copyright © 2023 Hazelcast, Inc.. All rights reserved.