Packages

package model

The model package containing models and options that help describe MongoCollection operations

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. model
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package changestream
  2. package densify

    Since

    4.7

    Note

    Requires MongoDB 5.1 or greater.

    See also

    Aggregates.densify

  3. package fill

    Since

    4.7

    Note

    Requires MongoDB 5.3 or greater.

    See also

    Aggregates.fill

  4. package geojson
  5. package search

    Query building API for MongoDB Atlas full-text 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

    Atlas Search

    Atlas Search aggregation pipeline stages

  6. package vault

    This package contains options classes for the key vault API

    This package contains options classes for the key vault API

    Since

    2.7

Type Members

  1. type ApproximateQuantileMethod = com.mongodb.client.model.ApproximateQuantileMethod

    Annotations
    @Sealed()
    See also

    QuantileMethod.approximate()

  2. type BsonField = com.mongodb.client.model.BsonField

    A representation of a BSON document field whose value is another BSON document.

  3. type BucketAutoOptions = com.mongodb.client.model.BucketAutoOptions

    The options for a $bucketAuto aggregation pipeline stage

    The options for a $bucketAuto aggregation pipeline stage

    Since

    1.2

  4. type BucketGranularity = com.mongodb.client.model.BucketGranularity

    Granularity values for automatic bucketing.

    Granularity values for automatic bucketing.

    Since

    1.2

    See also

    numbers

  5. type BucketOptions = com.mongodb.client.model.BucketOptions

    The options for a $bucket aggregation pipeline stage

    The options for a $bucket aggregation pipeline stage

    Since

    1.2

  6. type BulkWriteOptions = com.mongodb.client.model.BulkWriteOptions

    The options to apply to a bulk write.

  7. type ChangeStreamPreAndPostImagesOptions = com.mongodb.client.model.ChangeStreamPreAndPostImagesOptions

    Options for change stream pre- and post- images

  8. type ClusteredIndexOptions = com.mongodb.client.model.ClusteredIndexOptions

    Options for creating a clustered index on a collection

  9. type Collation = com.mongodb.client.model.Collation

    The collation options.

  10. type CollationAlternate = com.mongodb.client.model.CollationAlternate

    The collation alternative options.

  11. type CollationCaseFirst = com.mongodb.client.model.CollationCaseFirst

    The collation configuration of how character cases are handled

  12. type CollationMaxVariable = com.mongodb.client.model.CollationMaxVariable

    The collation max variable options

  13. type CollationStrength = com.mongodb.client.model.CollationStrength

    The collation configuration of how differences between characters are handled.

  14. type CountOptions = com.mongodb.client.model.CountOptions

    The options to apply to a count operation.

  15. type CreateCollectionOptions = com.mongodb.client.model.CreateCollectionOptions

    Options for creating a collection

  16. type CreateEncryptedCollectionParams = com.mongodb.client.model.CreateEncryptedCollectionParams

    Auxiliary parameters for creating an encrypted collection.

    Auxiliary parameters for creating an encrypted collection.

    Annotations
    @Beta()
    Since

    4.9

  17. type CreateIndexOptions = com.mongodb.client.model.CreateIndexOptions

    The options to apply to the command when creating indexes.

    The options to apply to the command when creating indexes.

    Since

    2.2

  18. type CreateViewOptions = com.mongodb.client.model.CreateViewOptions

    Options for creating a view

    Options for creating a view

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  19. type DeleteManyModel[TResult] = com.mongodb.client.model.DeleteManyModel[TResult]

    A model describing the removal of all documents matching the query filter.

  20. type DeleteOneModel[TResult] = com.mongodb.client.model.DeleteOneModel[TResult]

    A model describing the removal of at most one document matching the query filter.

  21. type DeleteOptions = com.mongodb.client.model.DeleteOptions

    The options to apply for delete operations

  22. type DropCollectionOptions = com.mongodb.client.model.DropCollectionOptions

    Options for creating a collection

    Options for creating a collection

    Since

    4.6

  23. type DropIndexOptions = com.mongodb.client.model.DropIndexOptions

    The options to apply to the command when creating indexes.

    The options to apply to the command when creating indexes.

    Since

    2.2

  24. type EstimatedDocumentCountOptions = com.mongodb.client.model.EstimatedDocumentCountOptions

    The options to apply to an estimated count operation.

    The options to apply to an estimated count operation.

    Since

    2.4

  25. type Facet = com.mongodb.client.model.Facet

    Defines a Facet for use in $facet pipeline stages.

    Defines a Facet for use in $facet pipeline stages.

    Since

    1.2

  26. type Field[TExpression] = com.mongodb.client.model.Field[TExpression]

    A helper to define new fields for the $addFields pipeline stage

    A helper to define new fields for the $addFields pipeline stage

    Since

    1.2

  27. type FindOneAndDeleteOptions = com.mongodb.client.model.FindOneAndDeleteOptions

    The options to apply to an operation that atomically finds a document and deletes it.

  28. type FindOneAndReplaceOptions = com.mongodb.client.model.FindOneAndReplaceOptions

    The options to apply to an operation that atomically finds a document and replaces it.

  29. type FindOneAndUpdateOptions = com.mongodb.client.model.FindOneAndUpdateOptions

    The options to apply to an operation that atomically finds a document and updates it.

  30. type GeoNearOptions = com.mongodb.client.model.GeoNearOptions
  31. type GraphLookupOptions = com.mongodb.client.model.GraphLookupOptions

    The options for a graphLookup aggregation pipeline stage

    The options for a graphLookup aggregation pipeline stage

    Since

    1.2

  32. type IndexModel = com.mongodb.client.model.IndexModel

    A model describing the creation of a single index.

  33. type IndexOptionDefaults = com.mongodb.client.model.IndexOptionDefaults

    The default options for a collection to apply on the creation of indexes.

    The default options for a collection to apply on the creation of indexes.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

    See also

    Index options

  34. type IndexOptions = com.mongodb.client.model.IndexOptions

    The options to apply to the creation of an index.

  35. type InsertManyOptions = com.mongodb.client.model.InsertManyOptions

    The options to apply to an operation that inserts multiple documents into a collection.

  36. type InsertOneModel[TResult] = com.mongodb.client.model.InsertOneModel[TResult]

    A model describing an insert of a single document.

  37. type InsertOneOptions = com.mongodb.client.model.InsertOneOptions

    The options to apply to an operation that inserts a single document into a collection.

    The options to apply to an operation that inserts a single document into a collection.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  38. type MapReduceAction = com.mongodb.client.model.MapReduceAction

    The map reduce to collection actions.

    The map reduce to collection actions.

    These actions are only available when passing out a collection that already exists. This option is not available on secondary members of replica sets. The Enum values dictate what to do with the output collection if it already exists when the map reduce is run.

  39. case class MergeOptions(wrapped: com.mongodb.client.model.MergeOptions = new JMergeOptions()) extends Product with Serializable

    Options to control the behavior of the $merge aggregation stage

    Options to control the behavior of the $merge aggregation stage

    Since

    2.7

  40. type PushOptions = com.mongodb.client.model.PushOptions

    The options to apply to a $push update operator.

  41. type RenameCollectionOptions = com.mongodb.client.model.RenameCollectionOptions

    The options to apply when renaming a collection

  42. type ReplaceOneModel[TResult] = com.mongodb.client.model.ReplaceOneModel[TResult]

    A model describing the replacement of at most one document that matches the query filter.

  43. type ReplaceOptions = com.mongodb.client.model.ReplaceOptions

    The options to apply when replacing documents.

    The options to apply when replacing documents.

    Since

    2.3

  44. type ReturnDocument = com.mongodb.client.model.ReturnDocument

    Indicates which document to return, the original document before change or the document after the change

  45. type SearchIndexModel = com.mongodb.client.model.SearchIndexModel

    A model describing the creation of a single Atlas Search index.

  46. type SearchIndexType = com.mongodb.client.model.SearchIndexType

    Represents an Atlas Search Index type, which is utilized for creating specific types of indexes.

  47. type TextSearchOptions = com.mongodb.client.model.TextSearchOptions

    Text search options for the Filters text helper

    Text search options for the Filters text helper

    Since

    1.1

    See also

    $text

  48. type TimeSeriesGranularity = com.mongodb.client.model.TimeSeriesGranularity

    Enumeration of values for time-series data granularity

  49. type TimeSeriesOptions = com.mongodb.client.model.TimeSeriesOptions

    Options for creating a time-series collection

  50. type UnwindOptions = com.mongodb.client.model.UnwindOptions

    The options for an unwind aggregation pipeline stage

    The options for an unwind aggregation pipeline stage

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  51. type UpdateManyModel[TResult] = com.mongodb.client.model.UpdateManyModel[TResult]

    A model describing an update to all documents that matches the query filter.

    A model describing an update to all documents that matches the query filter. The update to apply must include only update operators.

  52. type UpdateOneModel[TResult] = com.mongodb.client.model.UpdateOneModel[TResult]

    A model describing an update to at most one document that matches the query filter.

    A model describing an update to at most one document that matches the query filter. The update to apply must include only update operators.

  53. type UpdateOptions = com.mongodb.client.model.UpdateOptions

    The options to apply when updating documents.

  54. type ValidationAction = com.mongodb.client.model.ValidationAction

    Determines whether to error on invalid documents or just warn about the violations but allow invalid documents.

    Determines whether to error on invalid documents or just warn about the violations but allow invalid documents.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  55. type ValidationLevel = com.mongodb.client.model.ValidationLevel

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  56. type ValidationOptions = com.mongodb.client.model.ValidationOptions

    Validation options for documents being inserted or updated in a collection

    Validation options for documents being inserted or updated in a collection

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  57. type Variable[TExpression] = com.mongodb.client.model.Variable[TExpression]

    Helps define new variable for the $lookup pipeline stage

    Helps define new variable for the $lookup pipeline stage

    Since

    2.3

  58. type Window = com.mongodb.client.model.Window

    A subset of documents within a partition in the Aggregates.setWindowFields pipeline stage of an aggregation pipeline (see partitionBy in Aggregates.setWindowFields).

    A subset of documents within a partition in the Aggregates.setWindowFields pipeline stage of an aggregation pipeline (see partitionBy in Aggregates.setWindowFields).

    Since

    4.3

    See also

    Windows

  59. type WindowOutputField = com.mongodb.client.model.WindowOutputField

    The core part of the Aggregates.setWindowFields pipeline stage of an aggregation pipeline.

    The core part of the Aggregates.setWindowFields pipeline stage of an aggregation pipeline. A triple of a window function, a window and a path to a field to be computed by the window function over the window.

    Since

    4.3

    See also

    WindowOutputFields

  60. type WriteModel[TResult] = com.mongodb.client.model.WriteModel[TResult]

    A base class for models that can be used in a bulk write operations.

Value Members

  1. object Accumulators

    Builders for accumulators used in the group pipeline stage of an aggregation pipeline.

    Builders for accumulators used in the group pipeline stage of an aggregation pipeline.

    Since

    1.0

    See also

    Aggregation pipeline

    Accumulators

    Expressions

  2. object Aggregates

    Builders for aggregation pipeline stages.

    Builders for aggregation pipeline stages.

    Since

    1.0

    See also

    Aggregation pipeline

  3. object BsonField

    A representation of a BSON document field whose value is another BSON document.

  4. object BucketAutoOptions

    The options for a $bucketAuto aggregation pipeline stage

    The options for a $bucketAuto aggregation pipeline stage

    Since

    1.2

  5. object BucketGranularity

    Granularity values for automatic bucketing.

    Granularity values for automatic bucketing.

    Since

    1.2

    See also

    $bucketAuto

    numbers

  6. object BucketOptions

    The options for a $bucket aggregation pipeline stage

    The options for a $bucket aggregation pipeline stage

    Since

    1.2

  7. object BulkWriteOptions

    The options to apply to a bulk write.

  8. object ChangeStreamPreAndPostImagesOptions

    Options for change stream pre- and post- images

  9. object ClusteredIndexOptions

    Options for creating a clustered index on a collection

  10. object Collation

    The options regarding collation support in MongoDB 3.4+

    The options regarding collation support in MongoDB 3.4+

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  11. object CollationAlternate

    Collation support allows the specific configuration of whether or not spaces and punctuation are considered base characters.

    Collation support allows the specific configuration of whether or not spaces and punctuation are considered base characters.

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  12. object CollationCaseFirst

    Collation support allows the specific configuration of how character cases are handled.

    Collation support allows the specific configuration of how character cases are handled.

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  13. object CollationMaxVariable

    Collation support allows the specific configuration of whether or not spaces and punctuation are considered base characters.

    Collation support allows the specific configuration of whether or not spaces and punctuation are considered base characters.

    CollationMaxVariable controls which characters are affected by CollationAlternate$.SHIFTED.

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  14. object CollationStrength

    Collation support allows the specific configuration of how character cases are handled.

    Collation support allows the specific configuration of how character cases are handled.

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  15. object CountOptions

    The options to apply to a count operation.

  16. object CreateCollectionOptions

    Options for creating a collection

  17. object CreateEncryptedCollectionParams

    Auxiliary parameters for creating an encrypted collection.

    Auxiliary parameters for creating an encrypted collection.

    Annotations
    @Beta()
    Since

    4.9

  18. object CreateViewOptions

    Options for creating a view

    Options for creating a view

    Since

    1.2

    Note

    Requires MongoDB 3.4 or greater

  19. object DeleteManyModel

    A model describing the removal of all documents matching the query filter.

  20. object DeleteOneModel

    A model describing the removal of at most one document matching the query filter.

  21. object DeleteOptions

    The options to apply for delete operations.

  22. object DropCollectionOptions

    Options for creating a collection

    Options for creating a collection

    Since

    4.6

  23. object EstimatedDocumentCountOptions

    The options to apply to an estimated count operation.

    The options to apply to an estimated count operation.

    Since

    2.4

  24. object Facet

    Defines a Facet for use in $facet pipeline stages.

    Defines a Facet for use in $facet pipeline stages.

    Since

    1.2

  25. object Field

    A helper to define new fields for the $addFields pipeline stage

    A helper to define new fields for the $addFields pipeline stage

    Since

    1.2

  26. object Filters

    A factory for query filters.

    A factory for query filters. A convenient way to use this class is to statically import all of its methods, which allows usage like:

    collection.find(and(eq("x", 1), lt("y", 3)))

    Since

    1.0

  27. object FindOneAndDeleteOptions

    The options to apply to an operation that atomically finds a document and deletes it.

  28. object FindOneAndReplaceOptions

    The options to apply to an operation that atomically finds a document and replaces it.

  29. object FindOneAndUpdateOptions

    The options to apply to an operation that atomically finds a document and updates it.

  30. object GraphLookupOptions

    The options for a graphLookup aggregation pipeline stage

    The options for a graphLookup aggregation pipeline stage

    Since

    1.2

  31. object IndexModel

    A model describing the creation of a single index.

  32. object IndexOptionDefaults

    Options for creating an index

  33. object IndexOptions

    The options to apply to the creation of an index.

  34. object Indexes

    A factory for defining index keys.

    A factory for defining index keys. A convenient way to use this class is to statically import all of its methods, which allows usage like:

    collection.createIndex(compoundIndex(ascending("x"), descending("y")))
    Since

    1.0

  35. object InsertManyOptions

    The options to apply to an operation that inserts multiple documents into a collection.

  36. object InsertOneModel

    A model describing an insert of a single document.

  37. object InsertOneOptions

    The options to apply to an operation that inserts a single document into a collection.

    The options to apply to an operation that inserts a single document into a collection.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  38. object MergeOptions extends Serializable

    Options to control the behavior of the $merge aggregation stage

    Options to control the behavior of the $merge aggregation stage

    Since

    2.7

  39. object MongoTimeUnit

    Units for specifying time-based values.

    Units for specifying time-based values.

    Since

    4.3

    Note

    Requires MongoDB 5.0 or greater.

    See also

    Windows

    WindowOutputFields

    org.mongodb.scala.model.densify.DensifyRange

  40. object Projections

    A factory for projections.

    A factory for projections. A convenient way to use this class is to statically import all of its methods, which allows usage like:

    collection.find().projection(fields(include("x", "y"), excludeId()))

    Since

    1.0

  41. object PushOptions

    The options to apply to a $push update operator.

  42. object QuantileMethod

    This interface represents a quantile method used in quantile accumulators of the $group and $setWindowFields stages.

    This interface represents a quantile method used in quantile accumulators of the $group and $setWindowFields stages.

    It provides methods for creating and converting quantile methods to BsonValue.

    Annotations
    @Sealed()
    Since

    4.10

    Note

    Requires MongoDB 7.0 or greater

    See also

    org.mongodb.scala.model.Accumulators.percentile

    org.mongodb.scala.model.Accumulators.median

    org.mongodb.scala.model.WindowOutputFields.percentile

    org.mongodb.scala.model.WindowOutputFields.median

  43. object RenameCollectionOptions

    The options to apply when renaming a collection

  44. object ReplaceOneModel

    A model describing the replacement of at most one document that matches the query filter.

  45. object ReplaceOptions

    The options to apply when replacing documents.

    The options to apply when replacing documents.

    Since

    2.3

  46. object ReturnDocument

    Indicates which document to return, the original document before change or the document after the change

    Indicates which document to return, the original document before change or the document after the change

    Since

    1.0

  47. object SearchIndexModel

    A model describing the creation of a single Atlas Search index.

  48. object Sorts

    A factory for sort specifications.

    A factory for sort specifications. A convenient way to use this class is to statically import all of its methods, which allows usage like:

    collection.find().sort(orderBy(ascending("x", "y"), descending("z")))

    Since

    1.0

  49. object TextSearchOptions

    Text search options for the Filters text helper

    Text search options for the Filters text helper

    Since

    1.1

  50. object TimeSeriesOptions

    Options for creating a time-series collection

  51. object UnwindOptions

    The options for an unwind aggregation pipeline stage

    The options for an unwind aggregation pipeline stage

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  52. object UpdateManyModel

    A model describing an update to all documents that matches the query filter.

    A model describing an update to all documents that matches the query filter. The update to apply must include only update operators.

  53. object UpdateOneModel

    A model describing an update to at most one document that matches the query filter.

    A model describing an update to at most one document that matches the query filter. The update to apply must include only update operators.

  54. object UpdateOptions

    The options to apply when updating documents.

  55. object Updates

    A factory for document updates.

    A factory for document updates. A convenient way to use this class is to statically import all of its methods, which allows usage like:

    collection.updateOne(eq("x", 1), set("x", 2))

    Since

    1.0

  56. object ValidationAction

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  57. object ValidationLevel

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  58. object ValidationOptions

    Validation options for documents being inserted or updated in a collection

    Validation options for documents being inserted or updated in a collection

    Since

    1.1

    Note

    Requires MongoDB 3.2 or greater

  59. object Variable

    Helps define new variable for the $lookup pipeline stage

    Helps define new variable for the $lookup pipeline stage

    Since

    2.3

  60. object WindowOutputFields

    Builders for window output fields used in the Aggregates.setWindowFields pipeline stage of an aggregation pipeline.

    Builders for window output fields used in the Aggregates.setWindowFields pipeline stage of an aggregation pipeline. Each windowed output field is a triple:

    • A window function. Some functions require documents in a window to be sorted (see sortBy in Aggregates.setWindowFields).
    • An optional window, a.k.a. frame. Specifying None window is equivalent to specifying an unbounded window, i.e., a window with both ends specified as UNBOUNDED. Some window functions, e.g., WindowOutputFields.derivative, require an explicit unbounded window instead of None.
    • A path to an output field to be computed by the window function over the window.

    A windowed computation is similar to an accumulator but does not result in folding documents constituting the window into a single document.

    Since

    4.3

    Note

    Requires MongoDB 5.0 or greater.

    See also

    Field paths

  61. object Windows

    Builders for windows used when expressing window output fields.

    Builders for windows used when expressing window output fields. There are two types of windows: documents and range.

    Bounded and half-bounded windows require sorting. Window bounds are inclusive and the lower bound must always be less than or equal to the upper bound. The following type-specific rules are applied to windows:

    • documents
      • bounds
        • 0 refers to the current document and is functionally equivalent to CURRENT;
        • a negative value refers to documents preceding the current one;
        • a positive value refers to documents following the current one;
    • range
      • sortBy (see Aggregates.setWindowFields)
        • must contain exactly one field;
        • must specify the ascending sort order;
        • the sortBy field must be of either a numeric BSON type (see the $isNumber aggregation pipeline stage) or the BSON Date type if time bounds are used;
      • bounds
        • if numeric, i.e., not com.mongodb.client.model.Windows.Bound, then the bound is calculated by adding the value to the value of the sortBy field in the current document;
        • if CURRENT, then the bound is determined by the current document and not the current value of the sortBy field;
        • time bounds require specifying a time unit and are added as per the $dateAdd/$dateSubtract aggregation pipeline stage specification.
    Annotations
    @Beta()
    Since

    4.3

    Note

    Requires MongoDB 5.0 or greater.

    See also

    WindowOutputField

    $isNumber aggregation pipeline stage

    BSON Date type

    $dateAdd aggregation pipeline stage

    $dateSubtract aggregation pipeline stage

Deprecated Value Members

  1. object MapReduceAction

    The map reduce to collection actions.

    The map reduce to collection actions.

    These actions are only available when passing out a collection that already exists. This option is not available on secondary members of replica sets. The Enum values dictate what to do with the output collection if it already exists when the map reduce is run.

    Annotations
    @deprecated
    Deprecated

    (Since version 4.4.0) Superseded by aggregate

    Since

    1.0

Inherited from AnyRef

Inherited from Any

Ungrouped