Class

org.mongodb.scala

MongoCollection

Related Doc: package scala

Permalink

case class MongoCollection[TResult](wrapped: com.mongodb.async.client.MongoCollection[TResult]) extends Product with Serializable

The MongoCollection representation.

TResult

The type that this collection will encode documents from and decode documents to.

wrapped

the underlying java MongoCollection

Since

1.0

Linear Supertypes
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MongoCollection
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MongoCollection(wrapped: com.mongodb.async.client.MongoCollection[TResult])

    Permalink

    wrapped

    the underlying java MongoCollection

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def aggregate[C](pipeline: Seq[Bson])(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): AggregateObservable[C]

    Permalink

    Aggregates documents according to the specified aggregation pipeline.

    Aggregates documents according to the specified aggregation pipeline.

    pipeline

    the aggregate pipeline

    returns

    a Observable containing the result of the aggregation operation Aggregation

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def bulkWrite(requests: Seq[_ <: WriteModel[_ <: TResult]], options: BulkWriteOptions): Observable[BulkWriteResult]

    Permalink

    Executes a mix of inserts, updates, replaces, and deletes.

    Executes a mix of inserts, updates, replaces, and deletes.

    requests

    the writes to execute

    options

    the options to apply to the bulk write operation

    returns

    a Observable with a single element the BulkWriteResult

  7. def bulkWrite(requests: Seq[_ <: WriteModel[_ <: TResult]]): Observable[BulkWriteResult]

    Permalink

    Executes a mix of inserts, updates, replaces, and deletes.

    Executes a mix of inserts, updates, replaces, and deletes.

    requests

    the writes to execute

    returns

    a Observable with a single element the BulkWriteResult

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. lazy val codecRegistry: CodecRegistry

    Permalink

    Get the codec registry for the MongoDatabase.

    Get the codec registry for the MongoDatabase.

    returns

    the { @link org.bson.codecs.configuration.CodecRegistry}

  10. def count(filter: Bson, options: CountOptions): Observable[Long]

    Permalink

    Counts the number of documents in the collection according to the given options.

    Counts the number of documents in the collection according to the given options.

    filter

    the query filter

    options

    the options describing the count

    returns

    a Observable with a single element indicating the number of documents

  11. def count(filter: Bson): Observable[Long]

    Permalink

    Counts the number of documents in the collection according to the given options.

    Counts the number of documents in the collection according to the given options.

    filter

    the query filter

    returns

    a Observable with a single element indicating the number of documents

  12. def count(): Observable[Long]

    Permalink

    Counts the number of documents in the collection.

    Counts the number of documents in the collection.

    returns

    a Observable with a single element indicating the number of documents

  13. def createIndex(key: Bson, options: IndexOptions): Observable[String]

    Permalink

    Create Index

    key

    an object describing the index key(s), which may not be null. This can be of any type for which a { @code Codec} is registered

    options

    the options for the index

    returns

    a Observable with a single element indicating when the operation has completed

  14. def createIndex(key: Bson): Observable[String]

    Permalink

    Create an Index

    Create an Index

    key

    an object describing the index key(s), which may not be null. This can be of any type for which a { @code Codec} is registered

    returns

    a Observable with a single element indicating when the operation has completed Ensure Index

  15. def createIndexes(models: Seq[IndexModel]): Observable[String]

    Permalink

    Create Index

    models

    the list of indexes to create

    returns

    a Observable with a single element indicating when the operation has completed

  16. def deleteMany(filter: Bson): Observable[DeleteResult]

    Permalink

    Removes all documents from the collection that match the given query filter.

    Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.

    filter

    the query filter to apply the the delete operation

    returns

    a Observable with a single element the DeleteResult or with an com.mongodb.MongoException

  17. def deleteOne(filter: Bson): Observable[DeleteResult]

    Permalink

    Removes at most one document from the collection that matches the given filter.

    Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.

    filter

    the query filter to apply the the delete operation

    returns

    a Observable with a single element the DeleteResult or with an com.mongodb.MongoException

  18. def distinct[C](fieldName: String, filter: Bson)(implicit ct: ClassTag[C]): DistinctObservable[C]

    Permalink

    Gets the distinct values of the specified field name.

    Gets the distinct values of the specified field name.

    Distinct

    C

    the target type of the iterable.

    fieldName

    the field name

    filter

    the query filter

    returns

    a Observable emitting the sequence of distinct values

  19. def distinct[C](fieldName: String)(implicit ct: ClassTag[C]): DistinctObservable[C]

    Permalink

    Gets the distinct values of the specified field name.

    Gets the distinct values of the specified field name.

    Distinct

    C

    the target type of the iterable.

    fieldName

    the field name

    returns

    a Observable emitting the sequence of distinct values

  20. lazy val documentClass: Class[TResult]

    Permalink

    Get the default class to cast any documents returned from the database into.

    Get the default class to cast any documents returned from the database into.

    returns

    the default class to cast any documents into

  21. def drop(): Observable[Completed]

    Permalink

    Drops this collection from the Database.

    Drops this collection from the Database.

    returns

    a Observable with a single element indicating when the operation has completed Drop Collection

  22. def dropIndex(keys: Bson): Observable[Completed]

    Permalink

    Drops the index given the keys used to create it.

    Drops the index given the keys used to create it.

    keys

    the keys of the index to remove

    returns

    a Observable with a single element indicating when the operation has completed

  23. def dropIndex(indexName: String): Observable[Completed]

    Permalink

    Drops the given index.

    Drops the given index.

    Drop Indexes

    indexName

    the name of the index to remove

    returns

    a Observable with a single element indicating when the operation has completed

  24. def dropIndexes(): Observable[Completed]

    Permalink

    Drop all the indexes on this collection, except for the default on _id.

    Drop all the indexes on this collection, except for the default on _id.

    Drop Indexes

    returns

    a Observable with a single element indicating when the operation has completed

  25. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. def find[C](filter: Bson)(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): FindObservable[C]

    Permalink

    Finds all documents in the collection.

    Finds all documents in the collection.

    Find

    C

    the target document type of the iterable.

    filter

    the query filter

    returns

    the find Observable

  28. def find[C]()(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): FindObservable[C]

    Permalink

    Finds all documents in the collection.

    Finds all documents in the collection.

    Find

    C

    the target document type of the iterable.

    returns

    the find Observable

  29. def findOneAndDelete(filter: Bson, options: FindOneAndDeleteOptions): Observable[TResult]

    Permalink

    Atomically find a document and remove it.

    Atomically find a document and remove it.

    filter

    the query filter to find the document with

    options

    the options to apply to the operation

    returns

    a Observable with a single element the document that was removed. If no documents matched the query filter, then null will be returned

  30. def findOneAndDelete(filter: Bson): Observable[TResult]

    Permalink

    Atomically find a document and remove it.

    Atomically find a document and remove it.

    filter

    the query filter to find the document with

    returns

    a Observable with a single element the document that was removed. If no documents matched the query filter, then null will be returned

  31. def findOneAndReplace(filter: Bson, replacement: TResult, options: FindOneAndReplaceOptions): Observable[TResult]

    Permalink

    Atomically find a document and replace it.

    Atomically find a document and replace it.

    filter

    the query filter to apply the the replace operation

    replacement

    the replacement document

    options

    the options to apply to the operation

    returns

    a Observable with a single element the document that was replaced. Depending on the value of the { @code returnOriginal} property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned

  32. def findOneAndReplace(filter: Bson, replacement: TResult): Observable[TResult]

    Permalink

    Atomically find a document and replace it.

    Atomically find a document and replace it.

    filter

    the query filter to apply the the replace operation

    replacement

    the replacement document

    returns

    a Observable with a single element the document that was replaced. Depending on the value of the { @code returnOriginal} property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned

  33. def findOneAndUpdate(filter: Bson, update: Bson, options: FindOneAndUpdateOptions): Observable[TResult]

    Permalink

    Atomically find a document and update it.

    Atomically find a document and update it.

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    options

    the options to apply to the operation

    returns

    a Observable with a single element the document that was updated. Depending on the value of the { @code returnOriginal} property, this will either be the document as it was before the update or as it is after the update. If no documents matched the query filter, then null will be returned

  34. def findOneAndUpdate(filter: Bson, update: Bson): Observable[TResult]

    Permalink

    Atomically find a document and update it.

    Atomically find a document and update it.

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    returns

    a Observable with a single element the document that was updated before the update was applied. If no documents matched the query filter, then null will be returned

  35. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  36. def insertMany(documents: Seq[_ <: TResult], options: InsertManyOptions): Observable[Completed]

    Permalink

    Inserts a batch of documents.

    Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

    documents

    the documents to insert

    options

    the options to apply to the operation

    returns

    a Observable with a single element indicating when the operation has completed or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException

  37. def insertMany(documents: Seq[_ <: TResult]): Observable[Completed]

    Permalink

    Inserts a batch of documents.

    Inserts a batch of documents. The preferred way to perform bulk inserts is to use the BulkWrite API. However, when talking with a server < 2.6, using this method will be faster due to constraints in the bulk API related to error handling.

    documents

    the documents to insert

    returns

    a Observable with a single element indicating when the operation has completed or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException

  38. def insertOne(document: TResult, options: InsertOneOptions): Observable[Completed]

    Permalink

    Inserts the provided document.

    Inserts the provided document. If the document is missing an identifier, the driver should generate one.

    document

    the document to insert

    options

    the options to apply to the operation

    returns

    a Observable with a single element indicating when the operation has completed or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException

    Since

    1.1

  39. def insertOne(document: TResult): Observable[Completed]

    Permalink

    Inserts the provided document.

    Inserts the provided document. If the document is missing an identifier, the driver should generate one.

    document

    the document to insert

    returns

    a Observable with a single element indicating when the operation has completed or with either a com.mongodb.DuplicateKeyException or com.mongodb.MongoException

  40. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  41. def listIndexes[C]()(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): ListIndexesObservable[C]

    Permalink

    Get all the indexes in this collection.

    Get all the indexes in this collection.

    listIndexes

    C

    the target document type of the iterable.

    returns

    the fluent list indexes interface

  42. def mapReduce[C](mapFunction: String, reduceFunction: String)(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): MapReduceObservable[C]

    Permalink

    Aggregates documents according to the specified map-reduce function.

    Aggregates documents according to the specified map-reduce function.

    C

    the target document type of the iterable.

    mapFunction

    A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.

    reduceFunction

    A JavaScript function that "reduces" to a single object all the values associated with a particular key.

    returns

    a Observable containing the result of the map-reduce operation map-reduce

  43. lazy val namespace: MongoNamespace

    Permalink

    Gets the namespace of this collection.

    Gets the namespace of this collection.

    returns

    the namespace

  44. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  45. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  46. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. lazy val readConcern: ReadConcern

    Permalink

    Get the read concern for the MongoDatabase.

    Get the read concern for the MongoDatabase.

    returns

    the ReadConcern

    Since

    1.1

  48. lazy val readPreference: ReadPreference

    Permalink

    Get the read preference for the MongoDatabase.

    Get the read preference for the MongoDatabase.

    returns

    the { @link com.mongodb.ReadPreference}

  49. def renameCollection(newCollectionNamespace: MongoNamespace, options: RenameCollectionOptions): Observable[Completed]

    Permalink

    Rename the collection with oldCollectionName to the newCollectionName.

    Rename the collection with oldCollectionName to the newCollectionName.

    Rename collection

    newCollectionNamespace

    the name the collection will be renamed to

    options

    the options for renaming a collection

    returns

    a Observable with a single element indicating when the operation has completed

  50. def renameCollection(newCollectionNamespace: MongoNamespace): Observable[Completed]

    Permalink

    Rename the collection with oldCollectionName to the newCollectionName.

    Rename the collection with oldCollectionName to the newCollectionName.

    Rename collection

    newCollectionNamespace

    the namespace the collection will be renamed to

    returns

    a Observable with a single element indicating when the operation has completed

  51. def replaceOne(filter: Bson, replacement: TResult, options: UpdateOptions): Observable[UpdateResult]

    Permalink

    Replace a document in the collection according to the specified arguments.

    Replace a document in the collection according to the specified arguments.

    Replace

    filter

    the query filter to apply the the replace operation

    replacement

    the replacement document

    options

    the options to apply to the replace operation

    returns

    a Observable with a single element the UpdateResult

  52. def replaceOne(filter: Bson, replacement: TResult): Observable[UpdateResult]

    Permalink

    Replace a document in the collection according to the specified arguments.

    Replace a document in the collection according to the specified arguments.

    Replace

    filter

    the query filter to apply the the replace operation

    replacement

    the replacement document

    returns

    a Observable with a single element the UpdateResult

  53. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  54. def updateMany(filter: Bson, update: Bson, options: UpdateOptions): Observable[UpdateResult]

    Permalink

    Update a single document in the collection according to the specified arguments.

    Update a single document in the collection according to the specified arguments.

    Updates Update Operators

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    options

    the options to apply to the update operation

    returns

    a Observable with a single element the UpdateResult

  55. def updateMany(filter: Bson, update: Bson): Observable[UpdateResult]

    Permalink

    Update a single document in the collection according to the specified arguments.

    Update a single document in the collection according to the specified arguments.

    Updates Update Operators

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    returns

    a Observable with a single element the UpdateResult

  56. def updateOne(filter: Bson, update: Bson, options: UpdateOptions): Observable[UpdateResult]

    Permalink

    Update a single document in the collection according to the specified arguments.

    Update a single document in the collection according to the specified arguments.

    Updates Update Operators

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    options

    the options to apply to the update operation

    returns

    a Observable with a single element the UpdateResult

  57. def updateOne(filter: Bson, update: Bson): Observable[UpdateResult]

    Permalink

    Update a single document in the collection according to the specified arguments.

    Update a single document in the collection according to the specified arguments.

    Updates Update Operators

    filter

    a document describing the query filter, which may not be null. This can be of any type for which a { @code Codec} is registered

    update

    a document describing the update, which may not be null. The update to apply must include only update operators. This can be of any type for which a { @code Codec} is registered

    returns

    a Observable with a single element the UpdateResult

  58. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. def withCodecRegistry(codecRegistry: CodecRegistry): MongoCollection[TResult]

    Permalink

    Create a new MongoCollection instance with a different codec registry.

    Create a new MongoCollection instance with a different codec registry.

    codecRegistry

    the new { @link org.bson.codecs.configuration.CodecRegistry} for the collection

    returns

    a new MongoCollection instance with the different codec registry

  62. def withDocumentClass[C]()(implicit e: DefaultsTo[C, Document], ct: ClassTag[C]): MongoCollection[C]

    Permalink

    Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..

    Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..

    C

    The type that the new collection will encode documents from and decode documents to

    returns

    a new MongoCollection instance with the different default class

  63. def withReadConcern(readConcern: ReadConcern): MongoCollection[TResult]

    Permalink

    Create a new MongoCollection instance with a different read concern.

    Create a new MongoCollection instance with a different read concern.

    readConcern

    the new ReadConcern for the collection

    returns

    a new MongoCollection instance with the different ReadConcern

    Since

    1.1

  64. def withReadPreference(readPreference: ReadPreference): MongoCollection[TResult]

    Permalink

    Create a new MongoCollection instance with a different read preference.

    Create a new MongoCollection instance with a different read preference.

    readPreference

    the new { @link com.mongodb.ReadPreference} for the collection

    returns

    a new MongoCollection instance with the different readPreference

  65. def withWriteConcern(writeConcern: WriteConcern): MongoCollection[TResult]

    Permalink

    Create a new MongoCollection instance with a different write concern.

    Create a new MongoCollection instance with a different write concern.

    writeConcern

    the new { @link com.mongodb.WriteConcern} for the collection

    returns

    a new MongoCollection instance with the different writeConcern

  66. lazy val writeConcern: WriteConcern

    Permalink

    Get the write concern for the MongoDatabase.

    Get the write concern for the MongoDatabase.

    returns

    the { @link com.mongodb.WriteConcern}

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped