package search
Query building API for MongoDB Atlas full-text search.
While all the building blocks of this API, such as
SearchOptions
, SearchHighlight
, etc.,
are not necessary immutable, they are unmodifiable due to methods like
SearchHighlight.maxCharsToExamine
returning new instances instead of modifying the instance
on which they are called. This allows storing and using such instances as templates.
- Since
4.7
- See also
Aggregates.search
Aggregates.vectorSearch
- Alphabetic
- By Inheritance
- search
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type AddSearchScoreExpression = com.mongodb.client.model.search.AddSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.addExpression
- type ApproximateVectorSearchOptions = com.mongodb.client.model.search.ApproximateVectorSearchOptions
Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Configures approximate vector search for Atlas Vector Search to enable searches that may not return the exact closest vectors.
- Annotations
- @Sealed() @Beta()
- Since
5.2
- Note
Requires MongoDB 6.0.11, 7.0.2 or greater
- See also
- type AutocompleteSearchOperator = com.mongodb.client.model.search.AutocompleteSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.autocomplete(String, FieldSearchPath)
SearchOperator.autocomplete(Iterable, FieldSearchPath)
- type CompoundSearchOperator = com.mongodb.client.model.search.CompoundSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.compound()
- type CompoundSearchOperatorBase = com.mongodb.client.model.search.CompoundSearchOperatorBase
A base for a CompoundSearchOperator which allows creating instances of this operator.
A base for a CompoundSearchOperator which allows creating instances of this operator. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.compound()
- type ConstantSearchScore = com.mongodb.client.model.search.ConstantSearchScore
- Annotations
- @Sealed() @Beta()
- See also
SearchScore.constant
- type ConstantSearchScoreExpression = com.mongodb.client.model.search.ConstantSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.constantExpression
- type DateNearSearchOperator = com.mongodb.client.model.search.DateNearSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.near
- type DateRangeSearchOperator = com.mongodb.client.model.search.DateRangeSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.dateRange
- type DateRangeSearchOperatorBase = com.mongodb.client.model.search.DateRangeSearchOperatorBase
A base for a DateRangeSearchOperatorBase which allows creating instances of this operator.
A base for a DateRangeSearchOperatorBase which allows creating instances of this operator. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.dateRange
- type DateSearchFacet = com.mongodb.client.model.search.DateSearchFacet
- Annotations
- @Sealed() @Beta()
- See also
SearchFacet.dateFacet(String, FieldSearchPath, Iterable)
- type ExactVectorSearchOptions = com.mongodb.client.model.search.ExactVectorSearchOptions
Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Configures exact vector search for Atlas Vector Search to enable precise matching, ensuring that results are the closest vectors to a given query vector.
- Annotations
- @Sealed() @Beta()
- Since
5.2
- Note
Requires MongoDB 6.0.16, 7.0.10, 7.3.2 or greater
- See also
- type ExistsSearchOperator = com.mongodb.client.model.search.ExistsSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.exists(FieldSearchPath)
- type FacetSearchCollector = com.mongodb.client.model.search.FacetSearchCollector
- Annotations
- @Sealed() @Beta()
- See also
SearchCollector.facet(SearchOperator, Iterable)
- type FieldSearchPath = com.mongodb.client.model.search.FieldSearchPath
- Annotations
- @Sealed() @Beta()
- See also
SearchPath.fieldPath(String)
- type FilterCompoundSearchOperator = com.mongodb.client.model.search.FilterCompoundSearchOperator
A representation of a CompoundSearchOperator that allows changing
filter
-specific options, if any.A representation of a CompoundSearchOperator that allows changing
filter
-specific options, if any. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.- Annotations
- @Sealed() @Beta()
- See also
CompoundSearchOperatorBase.filter(Iterable)
- type FunctionSearchScore = com.mongodb.client.model.search.FunctionSearchScore
- Annotations
- @Sealed() @Beta()
- See also
SearchScore.function
- type FuzzySearchOptions = com.mongodb.client.model.search.FuzzySearchOptions
Fuzzy search options that may be used with some SearchOperators.
Fuzzy search options that may be used with some SearchOperators.
- Annotations
- @Sealed() @Beta()
- See also
- type GaussSearchScoreExpression = com.mongodb.client.model.search.GaussSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.gaussExpression
- type GeoNearSearchOperator = com.mongodb.client.model.search.GeoNearSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.near
- type Log1pSearchScoreExpression = com.mongodb.client.model.search.Log1pSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.log1p
- type LogSearchScoreExpression = com.mongodb.client.model.search.LogSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.log
- type LowerBoundSearchCount = com.mongodb.client.model.search.LowerBoundSearchCount
- Annotations
- @Sealed() @Beta()
- See also
SearchCount.lowerBound()
- type MultiplySearchScoreExpression = com.mongodb.client.model.search.MultiplySearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.multiplyExpression
- type MustCompoundSearchOperator = com.mongodb.client.model.search.MustCompoundSearchOperator
A representation of a CompoundSearchOperator that allows changing
must
-specific options, if any.A representation of a CompoundSearchOperator that allows changing
must
-specific options, if any. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.- Annotations
- @Sealed() @Beta()
- See also
CompoundSearchOperatorBase.must(Iterable)
- type MustNotCompoundSearchOperator = com.mongodb.client.model.search.MustNotCompoundSearchOperator
A representation of a CompoundSearchOperator that allows changing
mustNot
-specific options, if any.A representation of a CompoundSearchOperator that allows changing
mustNot
-specific options, if any. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.- Annotations
- @Sealed() @Beta()
- See also
CompoundSearchOperatorBase.mustNot(Iterable)
- type NumberNearSearchOperator = com.mongodb.client.model.search.NumberNearSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.near
- type NumberRangeSearchOperator = com.mongodb.client.model.search.NumberRangeSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.numberRange
- type NumberRangeSearchOperatorBase = com.mongodb.client.model.search.NumberRangeSearchOperatorBase
A base for a NumberRangeSearchOperatorBase which allows creating instances of this operator.
A base for a NumberRangeSearchOperatorBase which allows creating instances of this operator. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.numberRange
- type NumberSearchFacet = com.mongodb.client.model.search.NumberSearchFacet
- Annotations
- @Sealed() @Beta()
- See also
SearchFacet.numberFacet(String, FieldSearchPath, Iterable)
- type PathBoostSearchScore = com.mongodb.client.model.search.PathBoostSearchScore
- Annotations
- @Sealed() @Beta()
- See also
SearchScore.boost(FieldSearchPath)
- type PathSearchScoreExpression = com.mongodb.client.model.search.PathSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.pathExpression
- type RelevanceSearchScoreExpression = com.mongodb.client.model.search.RelevanceSearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScoreExpression.relevanceExpression
- type SearchCollector = com.mongodb.client.model.search.SearchCollector
The core part of the
$search
pipeline stage of an aggregation pipeline.The core part of the
$search
pipeline stage of an aggregation pipeline. SearchCollectors allow returning metadata together with the matching search results. You may use the$$SEARCH_META
variable, e.g., via Projections.computedSearchMeta, to extract this metadata.- Annotations
- @Sealed() @Beta()
- See also
- type SearchCount = com.mongodb.client.model.search.SearchCount
Counting options.
Counting options. You may use the
$$SEARCH_META
variable, e.g., via Projections.computedSearchMeta, to extract the results of counting. You may use Projections.computedSearchMeta to extract the count results.- Annotations
- @Sealed() @Beta()
- See also
- type SearchFacet = com.mongodb.client.model.search.SearchFacet
A facet definition for FacetSearchCollector.
A facet definition for FacetSearchCollector.
- Annotations
- @Sealed() @Beta()
- See also
- type SearchHighlight = com.mongodb.client.model.search.SearchHighlight
Highlighting options.
Highlighting options. You may use the
$meta: "searchHighlights"
expression, e.g., via Projections.metaSearchHighlights, to extract the results of highlighting.- Annotations
- @Sealed() @Beta()
- See also
- type SearchOperator = com.mongodb.client.model.search.SearchOperator
The core part of the
$search
pipeline stage of an aggregation pipeline.The core part of the
$search
pipeline stage of an aggregation pipeline.- Annotations
- @Sealed() @Beta()
- See also
- type SearchOptions = com.mongodb.client.model.search.SearchOptions
Represents optional fields of the
$search
pipeline stage of an aggregation pipeline.Represents optional fields of the
$search
pipeline stage of an aggregation pipeline.- Annotations
- @Sealed() @Beta()
- See also
- type SearchPath = com.mongodb.client.model.search.SearchPath
A specification of fields to be searched.
A specification of fields to be searched.
Despite
SearchPath
beingBson
, its value conforming to the correct syntax must be obtained via eitherSearchPath.toBsonValue
orFieldSearchPath.toValue
.- Annotations
- @Sealed() @Beta()
- See also
- type SearchScore = com.mongodb.client.model.search.SearchScore
A modifier of the relevance score.
A modifier of the relevance score. You may use the
$meta: "searchScore"
expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.- Annotations
- @Sealed() @Beta()
- See also
- type SearchScoreExpression = com.mongodb.client.model.search.SearchScoreExpression
- Annotations
- @Sealed() @Beta()
- See also
SearchScore.function
- type ShouldCompoundSearchOperator = com.mongodb.client.model.search.ShouldCompoundSearchOperator
A representation of a CompoundSearchOperator that allows changing
should
-specific options, if any.A representation of a CompoundSearchOperator that allows changing
should
-specific options, if any. This interface is a technicality and does not represent a meaningful element of the full-text search query syntax.- Annotations
- @Sealed() @Beta()
- See also
CompoundSearchOperatorBase.should(Iterable)
- type StringSearchFacet = com.mongodb.client.model.search.StringSearchFacet
- Annotations
- @Sealed() @Beta()
- See also
SearchFacet.stringFacet(String, FieldSearchPath)
- type TextSearchOperator = com.mongodb.client.model.search.TextSearchOperator
- Annotations
- @Sealed() @Beta()
- See also
SearchOperator.text(String, SearchPath)
SearchOperator.text(Iterable, Iterable)
- type TotalSearchCount = com.mongodb.client.model.search.TotalSearchCount
- Annotations
- @Sealed() @Beta()
- See also
SearchCount.total()
- type ValueBoostSearchScore = com.mongodb.client.model.search.ValueBoostSearchScore
- Annotations
- @Sealed() @Beta()
- See also
SearchScore.boost(float)
- type VectorSearchOptions = com.mongodb.client.model.search.VectorSearchOptions
Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.- Annotations
- @Sealed() @Beta()
- Since
4.11
- Note
Requires MongoDB 6.0.11 or greater
- See also
- type WildcardSearchPath = com.mongodb.client.model.search.WildcardSearchPath
- Annotations
- @Sealed() @Beta()
- See also
SearchPath.wildcardPath(String)
Value Members
- object FuzzySearchOptions
Fuzzy search options that may be used with some
SearchOperator
s.Fuzzy search options that may be used with some
SearchOperator
s.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchCollector
The core part of the
$search
pipeline stage of an aggregation pipeline.The core part of the
$search
pipeline stage of an aggregation pipeline.SearchCollector
s allow returning metadata together with the matching search results. You may use the$$SEARCH_META
variable, e.g., via Projections.computedSearchMeta, to extract this metadata.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchCount
Counting options.
Counting options. You may use the
$$SEARCH_META
variable, e.g., via Projections.computedSearchMeta, to extract the results of counting.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchFacet
A facet definition for FacetSearchCollector.
A facet definition for FacetSearchCollector.
- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchHighlight
Highlighting options.
Highlighting options. You may use the
$meta: "searchHighlights"
expression, e.g., via Projections.metaSearchHighlights, to extract the results of highlighting.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchOperator
The core part of the
$search
pipeline stage of an aggregation pipeline.The core part of the
$search
pipeline stage of an aggregation pipeline.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchOptions
Represents optional fields of the
$search
pipeline stage of an aggregation pipeline.Represents optional fields of the
$search
pipeline stage of an aggregation pipeline.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchPath
A specification of fields to be searched.
A specification of fields to be searched.
Depending on the context, one of the following methods may be used to get a representation of a
SearchPath
with the correct syntax:SearchPath.toBsonDocument
,SearchPath.toBsonValue
,FieldSearchPath.toValue
.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchScore
A modifier of the relevance score.
A modifier of the relevance score. You may use the
$meta: "searchScore"
expression, e.g., via Projections.metaSearchScore, to extract the relevance score assigned to each found document.- Annotations
- @Beta()
- Since
4.7
- See also
- object SearchScoreExpression
- Annotations
- @Beta()
- Since
4.7
- See also
- object VectorSearchOptions
Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.Represents optional fields of the
$vectorSearch
pipeline stage of an aggregation pipeline.- Since
4.11
- Note
Requires MongoDB 6.0.11, or greater
- See also
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: