Class MongoDbEmbeddingStore.Builder
java.lang.Object
dev.langchain4j.store.embedding.mongodb.MongoDbEmbeddingStore.Builder
- Enclosing class:
MongoDbEmbeddingStore
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
collectionName
(String collectionName) createCollectionOptions
(com.mongodb.client.model.CreateCollectionOptions createCollectionOptions) createIndex
(Boolean createIndex) Set whether in production mode, production mode will not create index automaticallydatabaseName
(String databaseName) filter
(org.bson.conversions.Bson filter) Document query filter, all fields included in filter must be contained inIndexMapping.metadataFieldNames
fromClient
(com.mongodb.client.MongoClient mongoClient) Build Mongo Client, Please close the client to release resources after usageindexMapping
(IndexMapping indexMapping) set MongoDB search index fields mappingmaxResultRatio
(Long maxResultRatio)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
fromClient
Build Mongo Client, Please close the client to release resources after usage -
databaseName
-
collectionName
-
indexName
-
maxResultRatio
-
createCollectionOptions
public MongoDbEmbeddingStore.Builder createCollectionOptions(com.mongodb.client.model.CreateCollectionOptions createCollectionOptions) -
filter
Document query filter, all fields included in filter must be contained inIndexMapping.metadataFieldNames
For example:
- AND filter: Filters.and(Filters.in("type", asList("TXT", "md")), Filters.eqFull("test-key", "test-value"))
- OR filter: Filters.or(Filters.in("type", asList("TXT", "md")), Filters.eqFull("test-key", "test-value"))
- Parameters:
filter
- document query filter- Returns:
- builder
-
indexMapping
set MongoDB search index fields mappingif
createIndex
is true, then indexMapping not work- Parameters:
indexMapping
- MongoDB search index fields mapping- Returns:
- builder
-
createIndex
Set whether in production mode, production mode will not create index automaticallydefault value is false
- Parameters:
createIndex
- whether in production mode- Returns:
- builder
-
build
-